some stuffs
This commit is contained in:
@@ -45,37 +45,33 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL vk_debuggerDebugCallback(
|
|||||||
VkDebugUtilsMessageTypeFlagsEXT messageType,
|
VkDebugUtilsMessageTypeFlagsEXT messageType,
|
||||||
const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,
|
const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,
|
||||||
void* pUserData) {
|
void* pUserData) {
|
||||||
|
struct vk_userData_t userData = *(struct vk_userData_t*)pUserData;
|
||||||
|
|
||||||
printf("Debuggger: %s\n", pCallbackData->pMessage);
|
gnMessageSeverity severity;
|
||||||
|
gnMessageType type;
|
||||||
|
gnMessageData data = {
|
||||||
|
.message = gnCreateString(pCallbackData->pMessage)
|
||||||
|
};
|
||||||
|
|
||||||
// struct vk_userData_t userData = *(struct vk_userData_t*)pUserData;
|
switch (messageSeverity) {
|
||||||
|
default: break;
|
||||||
|
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT: severity = GN_MESSAGE_VERBOSE; break;
|
||||||
|
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT: severity = GN_MESSAGE_INFO; break;
|
||||||
|
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT: severity = GN_MESSAGE_WARNING; break;
|
||||||
|
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT: severity = GN_MESSAGE_ERROR; break;
|
||||||
|
}
|
||||||
|
|
||||||
// gnMessageSeverity severity;
|
switch (messageType) {
|
||||||
// gnMessageType type;
|
default: break;
|
||||||
// gnMessageData data = {
|
case VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT: type = GN_DEBUG_MESSAGE_GENERAL; break;
|
||||||
// .message = gnCreateString(pCallbackData->pMessage)
|
case VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT: type = GN_DEBUG_MESSAGE_VALIDATION; break;
|
||||||
// };
|
case VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT: type = GN_DEBUG_MESSAGE_PERFORMANCE; break;
|
||||||
|
}
|
||||||
|
|
||||||
// switch (messageSeverity) {
|
gnDebuggerCallback callback = *userData.debuggerCallback;
|
||||||
// default: break;
|
gnBool result = callback(severity, type, data, userData.userData);
|
||||||
// case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT: severity = GN_MESSAGE_VERBOSE; break;
|
if (result == gnFalse) return VK_FALSE;
|
||||||
// case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT: severity = GN_MESSAGE_INFO; break;
|
return VK_TRUE;
|
||||||
// case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT: severity = GN_MESSAGE_WARNING; break;
|
|
||||||
// case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT: severity = GN_MESSAGE_ERROR; break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// switch (messageType) {
|
|
||||||
// default: break;
|
|
||||||
// case VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT: type = GN_DEBUG_MESSAGE_GENERAL; break;
|
|
||||||
// case VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT: type = GN_DEBUG_MESSAGE_VALIDATION; break;
|
|
||||||
// case VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT: type = GN_DEBUG_MESSAGE_PERFORMANCE; break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// gnDebuggerCallback callback = *userData.debuggerCallback;
|
|
||||||
// gnBool result = callback(severity, type, data, userData.userData);
|
|
||||||
// if (result == gnFalse) return VK_FALSE;
|
|
||||||
// else if (result == gnTrue) return VK_TRUE;
|
|
||||||
return VK_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult vk_createDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugUtilsMessengerEXT* pDebugMessenger) {
|
VkResult vk_createDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugUtilsMessengerEXT* pDebugMessenger) {
|
||||||
|
@@ -3,8 +3,6 @@
|
|||||||
#include "presentation_queue/vulkan_presentation_queue.h"
|
#include "presentation_queue/vulkan_presentation_queue.h"
|
||||||
#include "output_device/vulkan_output_devices.h"
|
#include "output_device/vulkan_output_devices.h"
|
||||||
|
|
||||||
#include "stdio.h"
|
|
||||||
|
|
||||||
gnReturnCode gnPresentFn(struct gnOutputDevice_t* device, struct gnPresentInfo_t info) {
|
gnReturnCode gnPresentFn(struct gnOutputDevice_t* device, struct gnPresentInfo_t info) {
|
||||||
VkSemaphore* waitSemaphores = malloc(sizeof(VkSemaphore) * info.waitCount);
|
VkSemaphore* waitSemaphores = malloc(sizeof(VkSemaphore) * info.waitCount);
|
||||||
for (int i = 0; i < info.waitCount; i++) waitSemaphores[i] = info.waitSemaphores[i]->semaphore->semaphore;
|
for (int i = 0; i < info.waitCount; i++) waitSemaphores[i] = info.waitSemaphores[i]->semaphore->semaphore;
|
||||||
|
@@ -11,6 +11,17 @@ gnReturnCode gnCreatePresentationQueueFn(gnPresentationQueueHandle presentationQ
|
|||||||
presentationQueue->presentationQueue = malloc(sizeof(struct gnPlatformPresentationQueue_t));
|
presentationQueue->presentationQueue = malloc(sizeof(struct gnPlatformPresentationQueue_t));
|
||||||
|
|
||||||
vkSwapchainSupportDetails details = vkGetSwapchainSupport(device->physicalDevice.physicalDevice->device, presentationInfo.surface->windowSurface->surface);
|
vkSwapchainSupportDetails details = vkGetSwapchainSupport(device->physicalDevice.physicalDevice->device, presentationInfo.surface->windowSurface->surface);
|
||||||
|
|
||||||
|
if (details.capabilities.currentExtent.width != presentationInfo.imageSize.x || details.capabilities.currentExtent.height != presentationInfo.imageSize.y) {
|
||||||
|
gnDebuggerSetErrorMessage(device->instance->debugger,
|
||||||
|
(gnMessageData){
|
||||||
|
.message = gnCreateString("Image size is unsupposed for presentation queue")
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
presentationInfo.imageSize = (gnUInt2){ details.capabilities.currentExtent.width, details.capabilities.currentExtent.height };
|
||||||
|
}
|
||||||
|
|
||||||
if (details.formatCount == 0) {
|
if (details.formatCount == 0) {
|
||||||
gnDebuggerSetErrorMessage(device->instance->debugger,
|
gnDebuggerSetErrorMessage(device->instance->debugger,
|
||||||
(gnMessageData){
|
(gnMessageData){
|
||||||
|
@@ -88,10 +88,10 @@ struct gnSurfaceFormat_t* vkGetSurfaceFormats(
|
|||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct gnSurfaceDetails_t gnGetSurfaceDetailsFn(
|
gnSurfaceDetails gnGetSurfaceDetailsFn(
|
||||||
struct gnWindowSurface_t* windowSurface, struct gnPhysicalDevice_t device
|
gnWindowSurfaceHandle windowSurface, gnPhysicalDevice device
|
||||||
) {
|
) {
|
||||||
struct gnSurfaceDetails_t surfaceDetails;
|
gnSurfaceDetails surfaceDetails;
|
||||||
surfaceDetails.formats = vkGetSurfaceFormats(windowSurface, device, &surfaceDetails.formatCount);
|
surfaceDetails.formats = vkGetSurfaceFormats(windowSurface, device, &surfaceDetails.formatCount);
|
||||||
|
|
||||||
VkSurfaceCapabilitiesKHR details;
|
VkSurfaceCapabilitiesKHR details;
|
||||||
@@ -100,6 +100,10 @@ struct gnSurfaceDetails_t gnGetSurfaceDetailsFn(
|
|||||||
surfaceDetails.minImageCount = details.minImageCount;
|
surfaceDetails.minImageCount = details.minImageCount;
|
||||||
surfaceDetails.maxImageCount = details.maxImageCount;
|
surfaceDetails.maxImageCount = details.maxImageCount;
|
||||||
|
|
||||||
|
surfaceDetails.minImageSize = (gnUInt2){ details.minImageExtent.width, details.minImageExtent.height };
|
||||||
|
surfaceDetails.maxImageSize = (gnUInt2){ details.maxImageExtent.width, details.maxImageExtent.height };
|
||||||
|
surfaceDetails.currentSize = (gnUInt2){ details.currentExtent.width, details.currentExtent.height };
|
||||||
|
|
||||||
return surfaceDetails;
|
return surfaceDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -54,7 +54,7 @@ typedef struct gnFunctions_t {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void (*_gnDestroyWindowSurface)(gnWindowSurfaceHandle windowSurface);
|
void (*_gnDestroyWindowSurface)(gnWindowSurfaceHandle windowSurface);
|
||||||
struct gnSurfaceDetails_t (*_gnGetSurfaceDetails)(gnWindowSurfaceHandle windowSurface, struct gnPhysicalDevice_t device);
|
gnSurfaceDetails (*_gnGetSurfaceDetails)(gnWindowSurfaceHandle windowSurface, struct gnPhysicalDevice_t device);
|
||||||
} gnFunctions;
|
} gnFunctions;
|
||||||
|
|
||||||
#include "core/presentation_queue/gryphn_presentation_queue.h"
|
#include "core/presentation_queue/gryphn_presentation_queue.h"
|
||||||
|
@@ -10,7 +10,7 @@ struct gnSurfaceFormat_t* gnGetSupportedSurfaceFormats(
|
|||||||
struct gnPhysicalDevice_t device,
|
struct gnPhysicalDevice_t device,
|
||||||
uint32_t* formatCount
|
uint32_t* formatCount
|
||||||
) {
|
) {
|
||||||
struct gnSurfaceDetails_t surfaceDetails = windowSurface->instance->functions->_gnGetSurfaceDetails(windowSurface, device);
|
gnSurfaceDetails surfaceDetails = windowSurface->instance->functions->_gnGetSurfaceDetails(windowSurface, device);
|
||||||
*formatCount = surfaceDetails.formatCount;
|
*formatCount = surfaceDetails.formatCount;
|
||||||
return surfaceDetails.formats;
|
return surfaceDetails.formats;
|
||||||
}
|
}
|
||||||
@@ -54,16 +54,16 @@ struct gnSurfaceFormat_t gnGetPreferredSurfaceFormat(
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t gnGetMinImageCount(gnWindowSurfaceHandle surface, struct gnPhysicalDevice_t device) {
|
uint32_t gnGetMinImageCount(gnWindowSurfaceHandle surface, struct gnPhysicalDevice_t device) {
|
||||||
struct gnSurfaceDetails_t surfaceDetails = surface->instance->functions->_gnGetSurfaceDetails(surface, device);
|
gnSurfaceDetails surfaceDetails = surface->instance->functions->_gnGetSurfaceDetails(surface, device);
|
||||||
return surfaceDetails.minImageCount;
|
return surfaceDetails.minImageCount;
|
||||||
}
|
}
|
||||||
uint32_t gnGetMaxImageCount(gnWindowSurfaceHandle surface, struct gnPhysicalDevice_t device) {
|
uint32_t gnGetMaxImageCount(gnWindowSurfaceHandle surface, struct gnPhysicalDevice_t device) {
|
||||||
struct gnSurfaceDetails_t surfaceDetails = surface->instance->functions->_gnGetSurfaceDetails(surface, device);
|
gnSurfaceDetails surfaceDetails = surface->instance->functions->_gnGetSurfaceDetails(surface, device);
|
||||||
return surfaceDetails.maxImageCount;
|
return surfaceDetails.maxImageCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t gnGetPreferredImageCount(gnWindowSurfaceHandle surface, struct gnPhysicalDevice_t device) {
|
uint32_t gnGetPreferredImageCount(gnWindowSurfaceHandle surface, struct gnPhysicalDevice_t device) {
|
||||||
struct gnSurfaceDetails_t surfaceDetails = surface->instance->functions->_gnGetSurfaceDetails(surface, device);
|
gnSurfaceDetails surfaceDetails = surface->instance->functions->_gnGetSurfaceDetails(surface, device);
|
||||||
|
|
||||||
uint32_t imageCount = surfaceDetails.minImageCount + 1;
|
uint32_t imageCount = surfaceDetails.minImageCount + 1;
|
||||||
if (surfaceDetails.maxImageCount > 0 && imageCount > surfaceDetails.maxImageCount) {
|
if (surfaceDetails.maxImageCount > 0 && imageCount > surfaceDetails.maxImageCount) {
|
||||||
@@ -71,3 +71,5 @@ uint32_t gnGetPreferredImageCount(gnWindowSurfaceHandle surface, struct gnPhysi
|
|||||||
}
|
}
|
||||||
return imageCount;
|
return imageCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gnSurfaceDetails gnGetSurfaceDetails(gnWindowSurfaceHandle surface, gnPhysicalDevice device) { return surface->instance->functions->_gnGetSurfaceDetails(surface, device); }
|
||||||
|
@@ -9,12 +9,13 @@ typedef struct gnSurfaceFormat_t {
|
|||||||
gnColorSpace colorSpace;
|
gnColorSpace colorSpace;
|
||||||
} gnSurfaceFormat;
|
} gnSurfaceFormat;
|
||||||
|
|
||||||
typedef struct gnSurfaceDetails_t {
|
typedef struct gnSurfaceDetails {
|
||||||
uint32_t formatCount;
|
uint32_t formatCount;
|
||||||
struct gnSurfaceFormat_t* formats;
|
struct gnSurfaceFormat_t* formats;
|
||||||
|
|
||||||
uint32_t minImageCount, maxImageCount;
|
uint32_t minImageCount, maxImageCount;
|
||||||
} gnSufaceDetails;
|
gnUInt2 minImageSize, maxImageSize, currentSize;
|
||||||
|
} gnSurfaceDetails;
|
||||||
|
|
||||||
#ifdef GN_REVEAL_IMPL
|
#ifdef GN_REVEAL_IMPL
|
||||||
struct gnWindowSurface_t {
|
struct gnWindowSurface_t {
|
||||||
@@ -47,3 +48,6 @@ struct gnSurfaceFormat_t gnGetPreferredSurfaceFormat(
|
|||||||
uint32_t gnGetMinImageCount(gnWindowSurfaceHandle surface, struct gnPhysicalDevice_t device);
|
uint32_t gnGetMinImageCount(gnWindowSurfaceHandle surface, struct gnPhysicalDevice_t device);
|
||||||
uint32_t gnGetMaxImageCount(gnWindowSurfaceHandle surface, struct gnPhysicalDevice_t device);
|
uint32_t gnGetMaxImageCount(gnWindowSurfaceHandle surface, struct gnPhysicalDevice_t device);
|
||||||
uint32_t gnGetPreferredImageCount(gnWindowSurfaceHandle surface, struct gnPhysicalDevice_t device);
|
uint32_t gnGetPreferredImageCount(gnWindowSurfaceHandle surface, struct gnPhysicalDevice_t device);
|
||||||
|
|
||||||
|
|
||||||
|
gnSurfaceDetails gnGetSurfaceDetails(gnWindowSurfaceHandle surface, gnPhysicalDevice device);
|
||||||
|
Reference in New Issue
Block a user