Fixed warnings building on Android

This commit is contained in:
Sam Lantinga
2026-02-04 14:55:29 -08:00
parent cd14bf3d00
commit 1a99861510
4 changed files with 18 additions and 11 deletions

View File

@@ -11905,7 +11905,8 @@ static Uint8 VULKAN_INTERNAL_CreateInstance(VulkanRenderer *renderer, VulkanFeat
return 0; return 0;
} }
XrVulkanInstanceCreateInfoKHR xrCreateInfo = {XR_TYPE_VULKAN_INSTANCE_CREATE_INFO_KHR}; XrVulkanInstanceCreateInfoKHR xrCreateInfo = {};
xrCreateInfo.type = XR_TYPE_VULKAN_INSTANCE_CREATE_INFO_KHR;
xrCreateInfo.vulkanCreateInfo = &createInfo; xrCreateInfo.vulkanCreateInfo = &createInfo;
xrCreateInfo.systemId = renderer->xrSystemId; xrCreateInfo.systemId = renderer->xrSystemId;
xrCreateInfo.pfnGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_Vulkan_GetVkGetInstanceProcAddr(); xrCreateInfo.pfnGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_Vulkan_GetVkGetInstanceProcAddr();
@@ -12520,7 +12521,8 @@ static Uint8 VULKAN_INTERNAL_CreateLogicalDevice(
return 0; return 0;
} }
XrVulkanDeviceCreateInfoKHR xrDeviceCreateInfo = {XR_TYPE_VULKAN_DEVICE_CREATE_INFO_KHR}; XrVulkanDeviceCreateInfoKHR xrDeviceCreateInfo = {};
xrDeviceCreateInfo.type = XR_TYPE_VULKAN_DEVICE_CREATE_INFO_KHR;
xrDeviceCreateInfo.vulkanCreateInfo = &deviceCreateInfo; xrDeviceCreateInfo.vulkanCreateInfo = &deviceCreateInfo;
xrDeviceCreateInfo.systemId = renderer->xrSystemId; xrDeviceCreateInfo.systemId = renderer->xrSystemId;
xrDeviceCreateInfo.vulkanPhysicalDevice = renderer->physicalDevice; xrDeviceCreateInfo.vulkanPhysicalDevice = renderer->physicalDevice;
@@ -12651,7 +12653,7 @@ static bool VULKAN_INTERNAL_SearchForOpenXrGpuExtension(XrExtensionProperties *f
XrExtensionProperties *extension_properties = (XrExtensionProperties *)SDL_calloc(extension_count, sizeof(XrExtensionProperties)); XrExtensionProperties *extension_properties = (XrExtensionProperties *)SDL_calloc(extension_count, sizeof(XrExtensionProperties));
for (i = 0; i < extension_count; i++) for (i = 0; i < extension_count; i++)
extension_properties[i] = (XrExtensionProperties){XR_TYPE_EXTENSION_PROPERTIES}; extension_properties[i].type = XR_TYPE_EXTENSION_PROPERTIES;
result = xrEnumerateInstanceExtensionProperties(NULL, extension_count, &extension_count, extension_properties); result = xrEnumerateInstanceExtensionProperties(NULL, extension_count, &extension_count, extension_properties);
if (result != XR_SUCCESS) { if (result != XR_SUCCESS) {
@@ -12688,7 +12690,8 @@ static XrResult VULKAN_INTERNAL_GetXrMinimumVulkanApiVersion(XrVersion *minimumV
return xrResult; return xrResult;
} }
XrGraphicsRequirementsVulkanKHR graphicsRequirementsVulkan = {XR_TYPE_GRAPHICS_REQUIREMENTS_VULKAN2_KHR}; XrGraphicsRequirementsVulkanKHR graphicsRequirementsVulkan = {};
graphicsRequirementsVulkan.type = XR_TYPE_GRAPHICS_REQUIREMENTS_VULKAN2_KHR;
if ((xrResult = xrGetVulkanGraphicsRequirements2KHR(instance, systemId, &graphicsRequirementsVulkan)) != XR_SUCCESS) { if ((xrResult = xrGetVulkanGraphicsRequirements2KHR(instance, systemId, &graphicsRequirementsVulkan)) != XR_SUCCESS) {
SDL_LogDebug(SDL_LOG_CATEGORY_GPU, "Failed to get vulkan graphics requirements, got OpenXR error %d", xrResult); SDL_LogDebug(SDL_LOG_CATEGORY_GPU, "Failed to get vulkan graphics requirements, got OpenXR error %d", xrResult);
return xrResult; return xrResult;
@@ -13096,7 +13099,8 @@ static XrResult VULKAN_CreateXRSession(
const void *XR_MAY_ALIAS currentNextPtr = createinfo->next; const void *XR_MAY_ALIAS currentNextPtr = createinfo->next;
// KHR_vulkan_enable and KHR_vulkan_enable2 share this structure, so we don't need to change any logic here to handle both // KHR_vulkan_enable and KHR_vulkan_enable2 share this structure, so we don't need to change any logic here to handle both
XrGraphicsBindingVulkanKHR graphicsBinding = {XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR}; XrGraphicsBindingVulkanKHR graphicsBinding = {};
graphicsBinding.type = XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR;
graphicsBinding.instance = renderer->instance; graphicsBinding.instance = renderer->instance;
graphicsBinding.physicalDevice = renderer->physicalDevice; graphicsBinding.physicalDevice = renderer->physicalDevice;
graphicsBinding.device = renderer->logicalDevice; graphicsBinding.device = renderer->logicalDevice;

View File

@@ -49,7 +49,7 @@ static bool SDL_OPENXR_INTERNAL_InitializeAndroidLoader(void)
} }
#endif /* SDL_PLATFORM_ANDROID */ #endif /* SDL_PLATFORM_ANDROID */
bool SDL_OPENXR_INTERNAL_ValidationLayerAvailable() static bool SDL_OPENXR_INTERNAL_ValidationLayerAvailable(void)
{ {
#ifdef SDL_PLATFORM_ANDROID #ifdef SDL_PLATFORM_ANDROID
/* On Android/Quest, the xrGetInstanceProcAddr obtained through runtime negotiation /* On Android/Quest, the xrGetInstanceProcAddr obtained through runtime negotiation
@@ -131,7 +131,8 @@ XrResult SDL_OPENXR_INTERNAL_GPUInitOpenXR(
extensionNames[userExtensionCount + 1] = XR_KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME; extensionNames[userExtensionCount + 1] = XR_KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME;
#endif #endif
XrInstanceCreateInfo xrInstanceCreateInfo = { XR_TYPE_INSTANCE_CREATE_INFO }; XrInstanceCreateInfo xrInstanceCreateInfo = {};
xrInstanceCreateInfo.type = XR_TYPE_INSTANCE_CREATE_INFO;
xrInstanceCreateInfo.applicationInfo.apiVersion = SDL_GetNumberProperty(props, SDL_PROP_GPU_DEVICE_CREATE_XR_VERSION_NUMBER, XR_API_VERSION_1_0); xrInstanceCreateInfo.applicationInfo.apiVersion = SDL_GetNumberProperty(props, SDL_PROP_GPU_DEVICE_CREATE_XR_VERSION_NUMBER, XR_API_VERSION_1_0);
xrInstanceCreateInfo.enabledApiLayerCount = userApiLayerCount + ((debugMode && validationLayersAvailable) ? 1 : 0); // in debug mode, we enable the validation layer xrInstanceCreateInfo.enabledApiLayerCount = userApiLayerCount + ((debugMode && validationLayersAvailable) ? 1 : 0); // in debug mode, we enable the validation layer
xrInstanceCreateInfo.enabledApiLayerNames = apiLayerNames; xrInstanceCreateInfo.enabledApiLayerNames = apiLayerNames;
@@ -147,7 +148,8 @@ XrResult SDL_OPENXR_INTERNAL_GPUInitOpenXR(
} }
void *activity = SDL_GetAndroidActivity(); void *activity = SDL_GetAndroidActivity();
XrInstanceCreateInfoAndroidKHR instanceCreateInfoAndroid = { XR_TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR }; XrInstanceCreateInfoAndroidKHR instanceCreateInfoAndroid = {};
instanceCreateInfoAndroid.type = XR_TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR;
instanceCreateInfoAndroid.applicationVM = vm; instanceCreateInfoAndroid.applicationVM = vm;
instanceCreateInfoAndroid.applicationActivity = activity; instanceCreateInfoAndroid.applicationActivity = activity;
xrInstanceCreateInfo.next = &instanceCreateInfoAndroid; xrInstanceCreateInfo.next = &instanceCreateInfoAndroid;
@@ -184,7 +186,8 @@ XrResult SDL_OPENXR_INTERNAL_GPUInitOpenXR(
return false; return false;
} }
XrSystemGetInfo systemGetInfo = { XR_TYPE_SYSTEM_GET_INFO }; XrSystemGetInfo systemGetInfo = {};
systemGetInfo.type = XR_TYPE_SYSTEM_GET_INFO;
systemGetInfo.formFactor = (XrFormFactor)SDL_GetNumberProperty(props, SDL_PROP_GPU_DEVICE_CREATE_XR_FORM_FACTOR_NUMBER, XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY); systemGetInfo.formFactor = (XrFormFactor)SDL_GetNumberProperty(props, SDL_PROP_GPU_DEVICE_CREATE_XR_FORM_FACTOR_NUMBER, XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY);
if ((xrResult = (*xr)->xrGetSystem(*instance, &systemGetInfo, systemId)) != XR_SUCCESS) { if ((xrResult = (*xr)->xrGetSystem(*instance, &systemGetInfo, systemId)) != XR_SUCCESS) {
SDL_LogDebug(SDL_LOG_CATEGORY_GPU, "Failed to get OpenXR system"); SDL_LogDebug(SDL_LOG_CATEGORY_GPU, "Failed to get OpenXR system");

View File

@@ -18,7 +18,6 @@
misrepresented as being the original software. misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
#include "SDL_internal.h" #include "SDL_internal.h"
#include "SDL_openxrdyn.h" #include "SDL_openxrdyn.h"
@@ -26,6 +25,7 @@
#ifdef HAVE_GPU_OPENXR #ifdef HAVE_GPU_OPENXR
#include <SDL3/SDL_dlopennote.h> #include <SDL3/SDL_dlopennote.h>
#include <SDL3/SDL_openxr.h>
#if defined(SDL_PLATFORM_APPLE) #if defined(SDL_PLATFORM_APPLE)
static const char *openxr_library_names[] = { "libopenxr_loader.dylib", NULL }; static const char *openxr_library_names[] = { "libopenxr_loader.dylib", NULL };

View File

@@ -303,7 +303,7 @@ static SDL_hid_device *HIDAPI_DriverGameSir_GetInputHandle(SDL_HIDAPI_Device *de
static bool SendGameSirModeSwitch(SDL_HIDAPI_Device *device) static bool SendGameSirModeSwitch(SDL_HIDAPI_Device *device)
{ {
Gamesir_CommandMode cmd = { 0x01 }; Gamesir_CommandMode cmd = { 0x01, 0x00 };
Uint8 buf[64]; Uint8 buf[64];
SDL_zero(buf); SDL_zero(buf);
buf[0] = 0xA2; buf[0] = 0xA2;