add PresentationParameters

submit_rewrite
cosmonaut 2020-12-21 16:18:21 -08:00
parent 7de212c322
commit 9fa0e54e67
4 changed files with 20 additions and 14 deletions

View File

@ -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).

View File

@ -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
);
}

View File

@ -574,7 +574,7 @@ typedef struct REFRESH_Driver
{
const char *Name;
REFRESH_Device* (*CreateDevice)(
void *deviceWindowHandle,
REFRESH_PresentationParameters *presentationParameters,
uint8_t debugMode
);
} REFRESH_Driver;

View File

@ -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
)) {