diff --git a/include/Refresh.h b/include/Refresh.h index ccf4936..e9daee3 100644 --- a/include/Refresh.h +++ b/include/Refresh.h @@ -376,6 +376,12 @@ typedef struct REFRESH_TextureSlice uint32_t layer; /* 0-5 for cube, or z-slice for 3D */ } REFRESH_TextureSlice; +typedef struct REFRESH_PresentationParameters +{ + void* deviceWindowHandle; + REFRESH_PresentMode presentMode; +} REFRESH_PresentationParameters; + /* State structures */ typedef struct REFRESH_SamplerStateCreateInfo @@ -593,13 +599,12 @@ typedef void (REFRESHCALL * REFRESH_LogFunc)(const char *msg); /* Create a rendering context for use on the calling thread. * - * deviceWindowHandle: - * A handle to a window. - * If this is NULL, Refresh will run in headless mode. + * presentationParameters: + * If the windowHandle is NULL, Refresh will run in headless mode. * debugMode: Enable debug mode properties. */ REFRESHAPI REFRESH_Device* REFRESH_CreateDevice( - void *deviceWindowHandle, + REFRESH_PresentationParameters *presentationParameters, uint8_t debugMode ); @@ -1273,7 +1278,7 @@ REFRESHAPI void REFRESH_BindIndexBuffer( * * NOTE: * It is an error to call this function in headless mode. - * + * * texture: The image to present. * sourceRectangle: The region of the image to present (or NULL). * destinationRectangle: The region of the window to update (or NULL). diff --git a/src/Refresh.c b/src/Refresh.c index 30cc849..8fdcde7 100644 --- a/src/Refresh.c +++ b/src/Refresh.c @@ -127,7 +127,7 @@ uint32_t REFRESH_LinkedVersion(void) static int32_t selectedDriver = -1; REFRESH_Device* REFRESH_CreateDevice( - void *deviceWindowHandle, + REFRESH_PresentationParameters *presentationParameters, uint8_t debugMode ) { if (selectedDriver < 0) @@ -136,7 +136,7 @@ REFRESH_Device* REFRESH_CreateDevice( } return drivers[selectedDriver]->CreateDevice( - deviceWindowHandle, + presentationParameters, debugMode ); } diff --git a/src/Refresh_Driver.h b/src/Refresh_Driver.h index fb0f878..b793e3c 100644 --- a/src/Refresh_Driver.h +++ b/src/Refresh_Driver.h @@ -574,7 +574,7 @@ typedef struct REFRESH_Driver { const char *Name; REFRESH_Device* (*CreateDevice)( - void *deviceWindowHandle, + REFRESH_PresentationParameters *presentationParameters, uint8_t debugMode ); } REFRESH_Driver; diff --git a/src/Refresh_Driver_Vulkan.c b/src/Refresh_Driver_Vulkan.c index 7f8cba1..6210539 100644 --- a/src/Refresh_Driver_Vulkan.c +++ b/src/Refresh_Driver_Vulkan.c @@ -654,7 +654,7 @@ typedef struct VulkanRenderer VulkanResourceAccessType *swapChainResourceAccessTypes; uint32_t swapChainImageCount; VkExtent2D swapChainExtent; - + uint8_t needNewSwapChain; uint8_t shouldPresent; uint8_t swapChainImageAcquired; @@ -5647,7 +5647,7 @@ static uint8_t VULKAN_INTERNAL_CreateLogicalDevice( } static REFRESH_Device* VULKAN_CreateDevice( - void *deviceWindowHandle, + REFRESH_PresentationParameters *presentationParameters, uint8_t debugMode ) { REFRESH_Device *result; @@ -5681,23 +5681,24 @@ static REFRESH_Device* VULKAN_CreateDevice( renderer = (VulkanRenderer*) SDL_malloc(sizeof(VulkanRenderer)); result->driverData = (REFRESH_Renderer*) renderer; renderer->debugMode = debugMode; - renderer->headless = deviceWindowHandle == NULL; + renderer->headless = presentationParameters->deviceWindowHandle == NULL; /* Create the VkInstance */ - if (!VULKAN_INTERNAL_CreateInstance(renderer, deviceWindowHandle)) + if (!VULKAN_INTERNAL_CreateInstance(renderer, presentationParameters->deviceWindowHandle)) { REFRESH_LogError("Error creating vulkan instance"); return NULL; } - renderer->deviceWindowHandle = deviceWindowHandle; + renderer->deviceWindowHandle = presentationParameters->deviceWindowHandle; + renderer->presentMode = presentationParameters->presentMode; /* * Create the WSI vkSurface */ if (!SDL_Vulkan_CreateSurface( - (SDL_Window*) deviceWindowHandle, + (SDL_Window*) renderer->deviceWindowHandle, renderer->instance, &renderer->surface )) {