add PresentationParameters
parent
7de212c322
commit
9fa0e54e67
|
@ -376,6 +376,12 @@ typedef struct REFRESH_TextureSlice
|
||||||
uint32_t layer; /* 0-5 for cube, or z-slice for 3D */
|
uint32_t layer; /* 0-5 for cube, or z-slice for 3D */
|
||||||
} REFRESH_TextureSlice;
|
} REFRESH_TextureSlice;
|
||||||
|
|
||||||
|
typedef struct REFRESH_PresentationParameters
|
||||||
|
{
|
||||||
|
void* deviceWindowHandle;
|
||||||
|
REFRESH_PresentMode presentMode;
|
||||||
|
} REFRESH_PresentationParameters;
|
||||||
|
|
||||||
/* State structures */
|
/* State structures */
|
||||||
|
|
||||||
typedef struct REFRESH_SamplerStateCreateInfo
|
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.
|
/* Create a rendering context for use on the calling thread.
|
||||||
*
|
*
|
||||||
* deviceWindowHandle:
|
* presentationParameters:
|
||||||
* A handle to a window.
|
* If the windowHandle is NULL, Refresh will run in headless mode.
|
||||||
* If this is NULL, Refresh will run in headless mode.
|
|
||||||
* debugMode: Enable debug mode properties.
|
* debugMode: Enable debug mode properties.
|
||||||
*/
|
*/
|
||||||
REFRESHAPI REFRESH_Device* REFRESH_CreateDevice(
|
REFRESHAPI REFRESH_Device* REFRESH_CreateDevice(
|
||||||
void *deviceWindowHandle,
|
REFRESH_PresentationParameters *presentationParameters,
|
||||||
uint8_t debugMode
|
uint8_t debugMode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1273,7 +1278,7 @@ REFRESHAPI void REFRESH_BindIndexBuffer(
|
||||||
*
|
*
|
||||||
* NOTE:
|
* NOTE:
|
||||||
* It is an error to call this function in headless mode.
|
* It is an error to call this function in headless mode.
|
||||||
*
|
*
|
||||||
* texture: The image to present.
|
* texture: The image to present.
|
||||||
* sourceRectangle: The region of the image to present (or NULL).
|
* sourceRectangle: The region of the image to present (or NULL).
|
||||||
* destinationRectangle: The region of the window to update (or NULL).
|
* destinationRectangle: The region of the window to update (or NULL).
|
||||||
|
|
|
@ -127,7 +127,7 @@ uint32_t REFRESH_LinkedVersion(void)
|
||||||
static int32_t selectedDriver = -1;
|
static int32_t selectedDriver = -1;
|
||||||
|
|
||||||
REFRESH_Device* REFRESH_CreateDevice(
|
REFRESH_Device* REFRESH_CreateDevice(
|
||||||
void *deviceWindowHandle,
|
REFRESH_PresentationParameters *presentationParameters,
|
||||||
uint8_t debugMode
|
uint8_t debugMode
|
||||||
) {
|
) {
|
||||||
if (selectedDriver < 0)
|
if (selectedDriver < 0)
|
||||||
|
@ -136,7 +136,7 @@ REFRESH_Device* REFRESH_CreateDevice(
|
||||||
}
|
}
|
||||||
|
|
||||||
return drivers[selectedDriver]->CreateDevice(
|
return drivers[selectedDriver]->CreateDevice(
|
||||||
deviceWindowHandle,
|
presentationParameters,
|
||||||
debugMode
|
debugMode
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -574,7 +574,7 @@ typedef struct REFRESH_Driver
|
||||||
{
|
{
|
||||||
const char *Name;
|
const char *Name;
|
||||||
REFRESH_Device* (*CreateDevice)(
|
REFRESH_Device* (*CreateDevice)(
|
||||||
void *deviceWindowHandle,
|
REFRESH_PresentationParameters *presentationParameters,
|
||||||
uint8_t debugMode
|
uint8_t debugMode
|
||||||
);
|
);
|
||||||
} REFRESH_Driver;
|
} REFRESH_Driver;
|
||||||
|
|
|
@ -654,7 +654,7 @@ typedef struct VulkanRenderer
|
||||||
VulkanResourceAccessType *swapChainResourceAccessTypes;
|
VulkanResourceAccessType *swapChainResourceAccessTypes;
|
||||||
uint32_t swapChainImageCount;
|
uint32_t swapChainImageCount;
|
||||||
VkExtent2D swapChainExtent;
|
VkExtent2D swapChainExtent;
|
||||||
|
|
||||||
uint8_t needNewSwapChain;
|
uint8_t needNewSwapChain;
|
||||||
uint8_t shouldPresent;
|
uint8_t shouldPresent;
|
||||||
uint8_t swapChainImageAcquired;
|
uint8_t swapChainImageAcquired;
|
||||||
|
@ -5647,7 +5647,7 @@ static uint8_t VULKAN_INTERNAL_CreateLogicalDevice(
|
||||||
}
|
}
|
||||||
|
|
||||||
static REFRESH_Device* VULKAN_CreateDevice(
|
static REFRESH_Device* VULKAN_CreateDevice(
|
||||||
void *deviceWindowHandle,
|
REFRESH_PresentationParameters *presentationParameters,
|
||||||
uint8_t debugMode
|
uint8_t debugMode
|
||||||
) {
|
) {
|
||||||
REFRESH_Device *result;
|
REFRESH_Device *result;
|
||||||
|
@ -5681,23 +5681,24 @@ static REFRESH_Device* VULKAN_CreateDevice(
|
||||||
renderer = (VulkanRenderer*) SDL_malloc(sizeof(VulkanRenderer));
|
renderer = (VulkanRenderer*) SDL_malloc(sizeof(VulkanRenderer));
|
||||||
result->driverData = (REFRESH_Renderer*) renderer;
|
result->driverData = (REFRESH_Renderer*) renderer;
|
||||||
renderer->debugMode = debugMode;
|
renderer->debugMode = debugMode;
|
||||||
renderer->headless = deviceWindowHandle == NULL;
|
renderer->headless = presentationParameters->deviceWindowHandle == NULL;
|
||||||
|
|
||||||
/* Create the VkInstance */
|
/* Create the VkInstance */
|
||||||
if (!VULKAN_INTERNAL_CreateInstance(renderer, deviceWindowHandle))
|
if (!VULKAN_INTERNAL_CreateInstance(renderer, presentationParameters->deviceWindowHandle))
|
||||||
{
|
{
|
||||||
REFRESH_LogError("Error creating vulkan instance");
|
REFRESH_LogError("Error creating vulkan instance");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer->deviceWindowHandle = deviceWindowHandle;
|
renderer->deviceWindowHandle = presentationParameters->deviceWindowHandle;
|
||||||
|
renderer->presentMode = presentationParameters->presentMode;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the WSI vkSurface
|
* Create the WSI vkSurface
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!SDL_Vulkan_CreateSurface(
|
if (!SDL_Vulkan_CreateSurface(
|
||||||
(SDL_Window*) deviceWindowHandle,
|
(SDL_Window*) renderer->deviceWindowHandle,
|
||||||
renderer->instance,
|
renderer->instance,
|
||||||
&renderer->surface
|
&renderer->surface
|
||||||
)) {
|
)) {
|
||||||
|
|
Loading…
Reference in New Issue