first device functions loaded
This commit is contained in:
@@ -1,7 +1,55 @@
|
|||||||
#include "vulkan_loader.h"
|
#include "vulkan_loader.h"
|
||||||
|
#include <presentation_queue/vulkan_presentation_queue.h>
|
||||||
|
|
||||||
gnDeviceFunctions loadVulkanDeviceFunctions() {
|
gnDeviceFunctions loadVulkanDeviceFunctions() {
|
||||||
return (gnDeviceFunctions){
|
return (gnDeviceFunctions){
|
||||||
NULL
|
._gnCreatePresentationQueue = createPresentationQueue,
|
||||||
|
._gnPresentationQueueGetImage = getPresentQueueImage,
|
||||||
|
._gnDestroyPresentationQueue = destroyPresentationQueue
|
||||||
|
|
||||||
|
// gnReturnCode (*_gnCreateShaderModule)(gnShaderModuleHandle module, gnOutputDeviceHandle device, gnShaderModuleInfo shaderModuleInfo);
|
||||||
|
// void (*_gnDestroyShaderModule)(gnShaderModuleHandle module);
|
||||||
|
|
||||||
|
// gnReturnCode (*_gnCreateRenderPassDescriptor)(gnRenderPassDescriptorHandle renderPass, gnOutputDeviceHandle device, gnRenderPassDescriptorInfo info);
|
||||||
|
// void (*_gnDestroyRenderPassDescriptor)(gnRenderPassDescriptorHandle renderPass);
|
||||||
|
|
||||||
|
// gnReturnCode (*_gnCreateGraphicsPipeline)(gnGraphicsPipelineHandle pipeline, gnOutputDeviceHandle device, gnGraphicsPipelineInfo pipelineInfo);
|
||||||
|
// void (*_gnDestroyGraphicsPipeline)(gnGraphicsPipelineHandle pipeline);
|
||||||
|
|
||||||
|
// gnReturnCode (*_gnCreateFramebuffer)(gnFramebuffer framebuffer, gnOutputDeviceHandle device, gnFramebufferInfo framebufferInfo);
|
||||||
|
// void (*_gnDestroyFramebuffer)(gnFramebuffer framebuffer);
|
||||||
|
|
||||||
|
// gnReturnCode (*_gnCreateCommandPool)(gnCommandPoolHandle commandPool, gnOutputDeviceHandle device, gnCommandPoolInfo info);
|
||||||
|
// void (*_gnDestroyCommandPool)(gnCommandPoolHandle commandPool);
|
||||||
|
|
||||||
|
// gnReturnCode (*_gnCreateSemaphore)(gnSemaphoreHandle semaphore, gnOutputDeviceHandle device);
|
||||||
|
// void (*_gnDestroySemaphore)(gnSemaphoreHandle semaphore);
|
||||||
|
|
||||||
|
// gnReturnCode (*_gnCreateBuffer)(gnBufferHandle buffer, gnDeviceHandle device, gnBufferInfo info);
|
||||||
|
// void (*_gnBufferData)(gnBufferHandle buffer, size_t size, void* data);
|
||||||
|
// void* (*_gnMapBuffer)(gnBufferHandle buffer);
|
||||||
|
// void (*_gnDestroyBuffer)(gnBufferHandle buffer);
|
||||||
|
|
||||||
|
// gnReturnCode (*_gnCreateUniformPool)(gnUniformPool pool, gnDeviceHandle device);
|
||||||
|
// gnUniform* (*_gnUniformPoolAllocateUniforms)(gnUniformPool pool, gnUniformAllocationInfo allocInfo);
|
||||||
|
// void (*_gnDestroyUniformPool)(gnUniformPool pool);
|
||||||
|
|
||||||
|
// void (*_gnUpdateBufferUniform)(gnUniform uniform, gnBufferUniformInfo* bufferInfo);
|
||||||
|
// void (*_gnUpdateImageUniform)(gnUniform uniform, gnImageUniformInfo* imageInfo);
|
||||||
|
|
||||||
|
// gnReturnCode (*_gnCreateTexture)(gnTexture texture, gnDevice device, const gnTextureInfo info);
|
||||||
|
// void (*_gnTextureData)(gnTextureHandle texture, void* pixelData);
|
||||||
|
// void (*_gnDestroyTexture)(gnTexture texture);
|
||||||
|
|
||||||
|
// gnReturnCode (*_gnCreateFence)(gnFenceHandle fence, gnOutputDeviceHandle device);
|
||||||
|
// void (*_gnSignalFence)(gnFenceHandle fence);
|
||||||
|
// void (*_gnWaitForFence)(gnFenceHandle fence, uint64_t timeout);
|
||||||
|
// void (*_gnResetFence)(gnFenceHandle fence);
|
||||||
|
// void (*_gnDestroyFence)(gnFenceHandle fence);
|
||||||
|
|
||||||
|
// gnReturnCode (*_gnSubmit)(gnOutputDeviceHandle device, gnSubmitInfo submit);
|
||||||
|
// gnReturnCode (*_gnPresent)(gnOutputDeviceHandle device, gnPresentInfo info);
|
||||||
|
|
||||||
|
// void (*_gnWaitForDevice)(gnOutputDeviceHandle device);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
#include "sync/semaphore/vulkan_semaphore.h"
|
#include "sync/semaphore/vulkan_semaphore.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
|
||||||
gnReturnCode gnCreatePresentationQueueFn(gnPresentationQueueHandle presentationQueue, const gnDevice device, gnPresentationQueueInfo presentationInfo) {
|
gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue, const gnDevice device, gnPresentationQueueInfo presentationInfo) {
|
||||||
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);
|
||||||
@@ -123,7 +123,7 @@ gnReturnCode gnCreatePresentationQueueFn(gnPresentationQueueHandle presentationQ
|
|||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode gnPresentationQueueGetImageFn(gnPresentationQueueHandle presentationQueue, uint64_t timeout, struct gnSemaphore_t* semaphore, uint32_t* imageIndex) {
|
gnReturnCode getPresentQueueImage(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphore semaphore, uint32_t* imageIndex) {
|
||||||
VkResult result = vkAcquireNextImageKHR(
|
VkResult result = vkAcquireNextImageKHR(
|
||||||
presentationQueue->outputDevice->outputDevice->device,
|
presentationQueue->outputDevice->outputDevice->device,
|
||||||
presentationQueue->presentationQueue->swapChain,
|
presentationQueue->presentationQueue->swapChain,
|
||||||
@@ -135,7 +135,7 @@ gnReturnCode gnPresentationQueueGetImageFn(gnPresentationQueueHandle presentatio
|
|||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gnDestroyPresentationQueueFn(gnPresentationQueueHandle queue) {
|
void destroyPresentationQueue(gnPresentationQueueHandle queue) {
|
||||||
for (int i = 0; i < queue->imageCount; i++)
|
for (int i = 0; i < queue->imageCount; i++)
|
||||||
vkDestroyImageView(queue->outputDevice->outputDevice->device, queue->presentationQueue->swapChainImageViews[i], NULL);
|
vkDestroyImageView(queue->outputDevice->outputDevice->device, queue->presentationQueue->swapChainImageViews[i], NULL);
|
||||||
vkDestroySwapchainKHR(queue->outputDevice->outputDevice->device, queue->presentationQueue->swapChain, NULL);
|
vkDestroySwapchainKHR(queue->outputDevice->outputDevice->device, queue->presentationQueue->swapChain, NULL);
|
||||||
|
@@ -8,3 +8,7 @@ typedef struct gnPlatformPresentationQueue_t {
|
|||||||
VkImage* swapChainImages;
|
VkImage* swapChainImages;
|
||||||
VkImageView* swapChainImageViews;
|
VkImageView* swapChainImageViews;
|
||||||
} gnPlatformPresentationQueue;
|
} gnPlatformPresentationQueue;
|
||||||
|
|
||||||
|
gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue, const gnDevice device, gnPresentationQueueInfo presentationInfo);
|
||||||
|
gnReturnCode getPresentQueueImage(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphore semaphore, uint32_t* imageIndex);
|
||||||
|
void destroyPresentationQueue(gnPresentationQueueHandle queue);
|
||||||
|
Reference in New Issue
Block a user