do some more C stuff
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
// #include <utils/gryphn_bool.h>
|
||||
#include <utils/gryphn_bool.h>
|
||||
#include <utils/gryphn_error_code.h>
|
||||
#include <utils/version/gryphn_version.h>
|
||||
// #include <utils/math/gryphn_vec2.h>
|
||||
#include <utils/math/gryphn_vec2.h>
|
||||
// #include <utils/math/gryphn_vec3.h>
|
||||
// #include <utils/math/gryphn_vec4.h>
|
||||
// #include <utils/types/gryphn_color.h>
|
||||
@@ -10,7 +10,7 @@
|
||||
// #include <utils/types/gryphn_image_format.h>
|
||||
// #include <utils/strings/gryphn_string.h>
|
||||
|
||||
// typedef uint32_t gnUInt;
|
||||
typedef uint32_t gnUInt;
|
||||
// typedef gnChar gnByte;
|
||||
// typedef unsigned char gnUByte;
|
||||
// typedef int gnInt;
|
||||
|
@@ -0,0 +1,14 @@
|
||||
// #include "vulkan_swapchain.h"
|
||||
// #include "core/presentation_queue/gryphn_device_presentation_details.h"
|
||||
// #include "../output_device/vulkan_output_devices.h"
|
||||
// #include "../instance/vulkan_instance.h"
|
||||
|
||||
// GN_EXPORT gnDevicePresentationDetails gnGetDevicePresentationDetailsFn(const gnPhysicalOutputDevice& physicalOutputDevice) {
|
||||
// SwapChainSupportDetails swapChainSupport = querySwapChainSupport(physicalOutputDevice.physicalOutputDevice->instance->instance->window_surface, physicalOutputDevice.physicalOutputDevice->device);
|
||||
|
||||
// gnDevicePresentationDetails presentationDetails = gnDevicePresentationDetails{};
|
||||
// presentationDetails.MinimumImageCount = swapChainSupport.capabilities.minImageCount;
|
||||
// presentationDetails.MaximumImageCount = swapChainSupport.capabilities.maxImageCount;
|
||||
|
||||
// return presentationDetails;
|
||||
// }
|
@@ -0,0 +1,124 @@
|
||||
#include "vulkan_presentation_queue.h"
|
||||
|
||||
gnReturnCode gnCreatePresentationQueueFn() {
|
||||
|
||||
}
|
||||
|
||||
// #include "core/presentation_queue/gryphn_presentation_queue.h"
|
||||
// #include "vulkan_queue_families.h"
|
||||
// #include "vulkan_swapchain_support.h"
|
||||
// #include "vulkan_presentation_queue.h"
|
||||
// #include "../sync_objects/vulkan_sync_semaphore.h"
|
||||
// #include "../textures/vulkan_texture.h"
|
||||
// #include "../instance/vulkan_instance.h"
|
||||
|
||||
// GN_EXPORT gnImageFormat gnPresentationQueueGetImageFormatFn(gnPresentationQueue& presentationQueue) {
|
||||
// return (gnImageFormat)presentationQueue.presentationQueue->swapchainDetails.surfaceFormat.format;
|
||||
// }
|
||||
|
||||
// GN_EXPORT gnReturnCode gnCreatePresentationQueueFn(gnPresentationQueue* presentationQueue, const gnOutputDevice& device, gnPresentationDetails& details) {
|
||||
// presentationQueue->presentationQueue = new gnPlatformPresentationQueue();
|
||||
// presentationQueue->presentationQueue->outputDevice = const_cast<gnOutputDevice*>(&device);
|
||||
|
||||
// vulkanSwapchainDetails swapchain_details = vulkanGetSwapchainDetails(
|
||||
// { (float)details.ImageSize.x, (float)details.ImageSize.y },
|
||||
// device.physicalOutputDevice->physicalOutputDevice->instance->instance->window_surface,
|
||||
// device.physicalOutputDevice->physicalOutputDevice->device
|
||||
// );
|
||||
// presentationQueue->presentationQueue->swapchainDetails = swapchain_details;
|
||||
|
||||
// VkSwapchainCreateInfoKHR createInfo{};
|
||||
// createInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
|
||||
// createInfo.surface = device.physicalOutputDevice->physicalOutputDevice->instance->instance->window_surface;
|
||||
|
||||
// createInfo.minImageCount = details.ImageCount;
|
||||
// createInfo.imageFormat = swapchain_details.surfaceFormat.format;
|
||||
// createInfo.imageColorSpace = swapchain_details.surfaceFormat.colorSpace;
|
||||
// createInfo.imageExtent = swapchain_details.extent;
|
||||
// createInfo.imageArrayLayers = 1;
|
||||
// createInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
|
||||
// details.ImageSize = { swapchain_details.extent.width, swapchain_details.extent.height };
|
||||
|
||||
// QueueFamilyIndices indices = findQueueFamilies(device.physicalOutputDevice->physicalOutputDevice->instance->instance->window_surface, device.physicalOutputDevice->physicalOutputDevice->device);
|
||||
// uint32_t queueFamilyIndices[] = {indices.graphicsFamily.value(), indices.presentFamily.value()};
|
||||
|
||||
// if (indices.graphicsFamily != indices.presentFamily) {
|
||||
// createInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
|
||||
// createInfo.queueFamilyIndexCount = 2;
|
||||
// createInfo.pQueueFamilyIndices = queueFamilyIndices;
|
||||
// } else {
|
||||
// createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||
// createInfo.queueFamilyIndexCount = 0; // Optional
|
||||
// createInfo.pQueueFamilyIndices = nullptr; // Optional
|
||||
// }
|
||||
|
||||
// createInfo.preTransform = swapchain_details.swapChainSupport.capabilities.currentTransform;
|
||||
// createInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
||||
// createInfo.presentMode = swapchain_details.presentMode;
|
||||
// createInfo.clipped = VK_TRUE;
|
||||
// createInfo.oldSwapchain = VK_NULL_HANDLE;
|
||||
|
||||
// if (vkCreateSwapchainKHR(device.outputDevice->device, &createInfo, nullptr, &presentationQueue->presentationQueue->swapChain) != VK_SUCCESS) {
|
||||
// gnReturnError(GN_FAILED_CREATE_PRESENTATION_QUEUE, "too lazy to query vulkan why");
|
||||
// }
|
||||
|
||||
// std::vector<VkImage> swapChainImages;
|
||||
// vkGetSwapchainImagesKHR(device.outputDevice->device, presentationQueue->presentationQueue->swapChain, &details.ImageCount, nullptr);
|
||||
// swapChainImages.resize(details.ImageCount);
|
||||
// vkGetSwapchainImagesKHR(device.outputDevice->device, presentationQueue->presentationQueue->swapChain, &details.ImageCount, swapChainImages.data());
|
||||
|
||||
// presentationQueue->valid = true;
|
||||
// presentationQueue->presentationQueue->device = &device.outputDevice->device;
|
||||
|
||||
// if (gnListLength(presentationQueue->images) < swapChainImages.size()) {
|
||||
// for (size_t i = gnListLength(presentationQueue->images); i < swapChainImages.size(); i++) {
|
||||
// gnTexture newImage = gnTexture();
|
||||
// newImage.texture = new gnPlatformTexture();
|
||||
// gnListAdd(presentationQueue->images, newImage);
|
||||
// }
|
||||
// }
|
||||
|
||||
// for (size_t i = 0; i < swapChainImages.size(); i++) {
|
||||
// VkImageView imageView;
|
||||
// gnReturnCode code = createImageView(device, swapChainImages[i], swapchain_details.surfaceFormat.format, VK_IMAGE_ASPECT_COLOR_BIT, &imageView);
|
||||
// presentationQueue->images[i].texture->textureImageView = imageView;
|
||||
// presentationQueue->images[i].texture->textureImage = swapChainImages[i];
|
||||
// presentationQueue->images[i].texture->outputDevice = const_cast<gnOutputDevice*>(&device);
|
||||
// presentationQueue->images[i].texture->swapchainImage = true;
|
||||
// if (code != GN_SUCCESS) return code;
|
||||
// }
|
||||
|
||||
// return GN_SUCCESS;
|
||||
// }
|
||||
|
||||
// GN_EXPORT void gnDestroyPresentationQueueFn(gnPresentationQueue& queue) {
|
||||
// for (size_t i = 0; i < gnListLength(queue.images); i++)
|
||||
// vkDestroyImageView(*queue.presentationQueue->device, queue.images[i].texture->textureImageView, nullptr);
|
||||
// vkDestroySwapchainKHR(*queue.presentationQueue->device, queue.presentationQueue->swapChain, nullptr);
|
||||
// }
|
||||
|
||||
// GN_EXPORT gnReturnCode gnPresentationQueueGetNextImageAsyncFn(gnPresentationQueue& presentationQueue, const gnSyncSemaphore& semaphore, gnUInt* imageIndex) {
|
||||
// gnUInt nextImageIndex = 0;
|
||||
// presentationQueue.presentationQueue->result =
|
||||
// vkAcquireNextImageKHR(*presentationQueue.presentationQueue->device, presentationQueue.presentationQueue->swapChain, UINT64_MAX, semaphore.semaphore->semaphore, VK_NULL_HANDLE, &nextImageIndex);
|
||||
// *imageIndex = nextImageIndex;
|
||||
|
||||
// if (presentationQueue.presentationQueue->result != VK_SUCCESS) {
|
||||
// return GN_FAILED;
|
||||
// }
|
||||
|
||||
// return GN_SUCCESS;
|
||||
// }
|
||||
|
||||
// GN_EXPORT gnPresentationQueueState gnPresentationQueueGetStateFn(gnPresentationQueue& presentationQueue) {
|
||||
// if (presentationQueue.presentationQueue->result == VK_ERROR_OUT_OF_DATE_KHR) {
|
||||
// return GN_OUT_OF_DATE;
|
||||
// } else if (presentationQueue.presentationQueue->result == VK_SUBOPTIMAL_KHR) {
|
||||
// return GN_SUBOPTIMAL;
|
||||
// }
|
||||
// else if (presentationQueue.presentationQueue->result == VK_SUCCESS) {
|
||||
// return GN_VALID;
|
||||
// }
|
||||
// return GN_VALID;
|
||||
// }
|
@@ -44,6 +44,7 @@ typedef struct gnFunctions_t {
|
||||
void (*_gnDestroyWindowSurface)(struct gnWindowSurface_t* windowSurface);
|
||||
} gnFunctions;
|
||||
|
||||
#include "core/presentation_queue/gryphn_presentation_queue.h"
|
||||
typedef struct gnDeviceFunctions_t {
|
||||
|
||||
gnReturnCode (*_gnCreatePresentationQueue)(gnPresentationQueue* presentationQueue, const gnOutputDevice* device, struct gnPresentationQueueInfo_t presentationInfo);
|
||||
} gnDeviceFunctions;
|
||||
|
@@ -68,5 +68,5 @@ void gnLoadFunctions(struct gnDynamicLibrary_t* lib, struct gnFunctions_t* funct
|
||||
}
|
||||
|
||||
void gnLoadDeviceFunctions(struct gnDynamicLibrary_t* lib, struct gnDeviceFunctions_t* functions) {
|
||||
|
||||
gnLoadDLLFunction(lib, functions->_gnCreatePresentationQueue, "gnCreatePresentationQueueFn");
|
||||
}
|
||||
|
@@ -1,9 +0,0 @@
|
||||
#pragma once
|
||||
#include "../output_device/gryphn_physical_output_device.h"
|
||||
|
||||
struct gnDevicePresentationDetails {
|
||||
public:
|
||||
int MinimumImageCount, MaximumImageCount;
|
||||
};
|
||||
|
||||
inline gnDevicePresentationDetails (*gnGetDevicePresentationDetails)(const gnPhysicalOutputDevice& physicalOutputDevice);
|
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
#include <gryphn/gryphn_utils.h>
|
||||
|
||||
typedef struct gnPresentationDetails_t {
|
||||
gnUInt ImageCount;
|
||||
gnUInt2 ImageSize;
|
||||
} gnPresentationDetails;
|
@@ -1,4 +1,9 @@
|
||||
#include "gryphn_presentation_queue.h"
|
||||
#include "core/gryphn_platform_functions.h"
|
||||
|
||||
gnReturnCode gnCreatePresentationQueue(gnPresentationQueue* presentationQueue, const gnOutputDevice* device, struct gnPresentationQueueInfo_t presentationInfo){
|
||||
return device->deviceFunctions->_gnCreatePresentationQueue(presentationQueue, device, presentationInfo);
|
||||
}
|
||||
|
||||
// gnTexture* gnGetPresentationQueueImage(gnPresentationQueue& presentationQueue, int index) {
|
||||
// // if (index < gnListLength(presentationQueue.images))
|
||||
|
@@ -1,12 +1,16 @@
|
||||
#pragma once
|
||||
#include <gryphn/gryphn_utils.h>
|
||||
#include "gryphn_presentation_details.h"
|
||||
#include "core/output_device/gryphn_output_device.h"
|
||||
// #include "core/sync_objects/gryphn_sync_semaphore.h"
|
||||
#include "gryphn_present_queue_state.h"
|
||||
// #include "core/sync_objects/gryphn_sync_semaphore.h"
|
||||
// #include "core/textures/gryphn_texture.h"
|
||||
// #include "gryphn_device_presentation_details.h"
|
||||
|
||||
typedef struct gnPresentationQueueInfo_t {
|
||||
gnUInt ImageCount;
|
||||
gnUInt2 ImageSize;
|
||||
} gnPresentationQueueInfo;
|
||||
|
||||
struct gnPlatformPresentationQueue_t;
|
||||
|
||||
typedef struct gnPresentationQueue_t {
|
||||
@@ -18,6 +22,8 @@ typedef struct gnPresentationQueue_t {
|
||||
|
||||
// gnTexture* gnGetPresentationQueueImage(gnPresentationQueue& presentationQueue, int index);
|
||||
|
||||
gnReturnCode gnCreatePresentationQueue(gnPresentationQueue* presentationQueue, const gnOutputDevice* device, struct gnPresentationQueueInfo_t presentationInfo);
|
||||
|
||||
// inline gnReturnCode (*gnCreatePresentationQueue)(gnPresentationQueue* presentationQueue, const gnOutputDevice& device, gnPresentationDetails& details);
|
||||
// inline void (*gnDestroyPresentationQueue)(gnPresentationQueue& queue);
|
||||
// inline gnImageFormat (*_gnPresentationQueueGetImageFormat)(gnPresentationQueue& presentationQueue);
|
||||
|
Reference in New Issue
Block a user