finish new loader structure for vulkan
This commit is contained in:
24
projects/apis/vulkan/loader/vulkan_command_loader.c
Normal file
24
projects/apis/vulkan/loader/vulkan_command_loader.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "vulkan_loader.h"
|
||||
#include <commands/command_buffer/vulkan_command_buffer.h>
|
||||
#include <commands/commands/vulkan_commands.h>
|
||||
|
||||
gnCommandFunctions loadVulkanCommandFunctions() {
|
||||
return (gnCommandFunctions){
|
||||
._gnCommandPoolAllocateCommandBuffers = allocateCommandBuffers,
|
||||
._gnBeginCommandBuffer = beginCommandBuffer,
|
||||
._gnResetCommandBuffer = resetCommandBuffer,
|
||||
._gnEndCommandBuffer = endCommandBuffer,
|
||||
|
||||
._gnCommandBeginRenderPass = beginRenderPass,
|
||||
._gnCommandEndRenderPass = endRenderPass,
|
||||
._gnCommandBindGraphicsPipeline = bindGraphicsPipeline,
|
||||
._gnCommandSetViewport = setViewport,
|
||||
._gnCommandSetScissor = setScissor,
|
||||
._gnCommandBindUniform = bindUniform,
|
||||
._gnCommandPushConstant = pushConstant,
|
||||
|
||||
._gnCommandBindBuffer = bindBuffer,
|
||||
._gnCommandDraw = draw,
|
||||
._gnCommandDrawIndexed = drawIndexed,
|
||||
};
|
||||
}
|
@@ -6,7 +6,13 @@
|
||||
#include <framebuffers/vulkan_framebuffer.h>
|
||||
#include <textures/vulkan_texture.h>
|
||||
#include <uniforms/vulkan_uniform_pool.h>
|
||||
#include <uniforms/vulkan_uniform.h>
|
||||
#include <commands/command_pool/vulkan_command_pool.h>
|
||||
#include <buffers/vulkan_buffer.h>
|
||||
#include <sync/semaphore/vulkan_semaphore.h>
|
||||
#include <sync/fence/vulkan_fence.h>
|
||||
#include <present/vulkan_present.h>
|
||||
#include <submit/vulkan_submit.h>
|
||||
#include <output_device/vulkan_output_devices.h>
|
||||
|
||||
gnDeviceFunctions loadVulkanDeviceFunctions() {
|
||||
@@ -30,33 +36,32 @@ gnDeviceFunctions loadVulkanDeviceFunctions() {
|
||||
._gnCreateCommandPool = createCommandPool,
|
||||
._gnDestroyCommandPool = destroyCommandPool,
|
||||
|
||||
// gnReturnCode (*_gnCreateSemaphore)(gnSemaphoreHandle semaphore, gnOutputDeviceHandle device);
|
||||
// void (*_gnDestroySemaphore)(gnSemaphoreHandle semaphore);
|
||||
._gnCreateSemaphore = createSemaphore,
|
||||
._gnDestroySemaphore = destroySemaphore,
|
||||
|
||||
// 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);
|
||||
._gnCreateBuffer = createBuffer,
|
||||
._gnBufferData = bufferData,
|
||||
._gnMapBuffer = mapBuffer,
|
||||
._gnDestroyBuffer = destroyBuffer,
|
||||
|
||||
._gnCreateUniformPool = createUniformPool,
|
||||
._gnUniformPoolAllocateUniforms = allocateUniforms,
|
||||
._gnDestroyUniformPool = destroyUniformPool,
|
||||
|
||||
// void (*_gnUpdateBufferUniform)(gnUniform uniform, gnBufferUniformInfo* bufferInfo);
|
||||
// void (*_gnUpdateImageUniform)(gnUniform uniform, gnImageUniformInfo* imageInfo);
|
||||
._gnUpdateBufferUniform = updateBufferUniform,
|
||||
._gnUpdateImageUniform = updateImageUniform,
|
||||
|
||||
._gnCreateTexture = createTexture,
|
||||
._gnTextureData = textureData,
|
||||
._gnDestroyTexture = destroyTexture,
|
||||
|
||||
// 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);
|
||||
._gnCreateFence = createFence,
|
||||
._gnWaitForFence = waitForFence,
|
||||
._gnResetFence = resetFence,
|
||||
._gnDestroyFence = destroyFence,
|
||||
|
||||
// gnReturnCode (*_gnSubmit)(gnOutputDeviceHandle device, gnSubmitInfo submit);
|
||||
// gnReturnCode (*_gnPresent)(gnOutputDeviceHandle device, gnPresentInfo info);
|
||||
._gnSubmit = submit,
|
||||
._gnPresent = present,
|
||||
|
||||
._gnWaitForDevice = waitForDevice
|
||||
};
|
||||
|
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include "loader/src/gryphn_instance_functions.h"
|
||||
#include "loader/src/gryphn_device_functions.h"
|
||||
#include "loader/src/gryphn_command_functions.h"
|
||||
|
||||
gnInstanceFunctions loadVulkanInstanceFunctions();
|
||||
gnDeviceFunctions loadVulkanDeviceFunctions();
|
||||
gnCommandFunctions loadVulkanCommandFunctions();
|
||||
|
@@ -66,7 +66,7 @@ void VkCopyBuffer(VkBuffer source, VkBuffer destination, size_t size, VkCommandP
|
||||
VkEndTransferOperation(transferBuffer, pool, queue, device);
|
||||
}
|
||||
|
||||
gnReturnCode gnCreateBufferFn(gnBufferHandle buffer, gnOutputDeviceHandle device, gnBufferInfo info) {
|
||||
gnReturnCode createBuffer(gnBufferHandle buffer, gnOutputDeviceHandle device, gnBufferInfo info) {
|
||||
buffer->buffer = malloc(sizeof(struct gnPlatformBuffer_t));
|
||||
VkBufferUsageFlags usage = vkGryphnBufferType(info.type);
|
||||
buffer->buffer->useStagingBuffer = gnFalse;
|
||||
@@ -98,7 +98,7 @@ gnReturnCode gnCreateBufferFn(gnBufferHandle buffer, gnOutputDeviceHandle device
|
||||
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
void gnBufferDataFn(gnBufferHandle buffer, size_t dataSize, void* data) {
|
||||
void bufferData(gnBufferHandle buffer, size_t dataSize, void* data) {
|
||||
void* bufferData;
|
||||
if (buffer->buffer->useStagingBuffer) {
|
||||
vkMapMemory(buffer->device->outputDevice->device, buffer->buffer->stagingBuffer.memory, 0, dataSize, 0, &bufferData);
|
||||
@@ -114,7 +114,7 @@ void gnBufferDataFn(gnBufferHandle buffer, size_t dataSize, void* data) {
|
||||
vkUnmapMemory(buffer->device->outputDevice->device, buffer->buffer->buffer.memory);
|
||||
}
|
||||
}
|
||||
void* gnMapBufferFn(gnBufferHandle buffer) {
|
||||
void* mapBuffer(gnBufferHandle buffer) {
|
||||
void* data;
|
||||
vkMapMemory(buffer->device->outputDevice->device, buffer->buffer->buffer.memory, 0, buffer->info.size, 0, &data);
|
||||
return data;
|
||||
@@ -125,7 +125,7 @@ void gnDestroyVulkanBuffer(VkGryphnBuffer* buffer, VkDevice device) {
|
||||
vkFreeMemory(device, buffer->memory, NULL);
|
||||
}
|
||||
|
||||
void gnDestroyBufferFn(gnBufferHandle buffer) {
|
||||
void destroyBuffer(gnBufferHandle buffer) {
|
||||
if (buffer->buffer->useStagingBuffer == gnTrue) gnDestroyVulkanBuffer(&buffer->buffer->stagingBuffer, buffer->device->outputDevice->device);
|
||||
gnDestroyVulkanBuffer(&buffer->buffer->buffer, buffer->device->outputDevice->device);
|
||||
free(buffer->buffer);
|
||||
|
@@ -22,3 +22,8 @@ gnReturnCode VkCreateBuffer(
|
||||
VkMemoryPropertyFlags flags, VkBufferUsageFlags usage
|
||||
);
|
||||
uint32_t VkMemoryIndex(VkPhysicalDevice device, uint32_t memoryType, VkMemoryPropertyFlags flags, gnBool* foundMemory);
|
||||
|
||||
gnReturnCode createBuffer(gnBufferHandle buffer, gnOutputDeviceHandle device, gnBufferInfo info);
|
||||
void bufferData(gnBufferHandle buffer, size_t dataSize, void* data);
|
||||
void* mapBuffer(gnBufferHandle buffer);
|
||||
void destroyBuffer(gnBufferHandle buffer);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include "commands/command_pool/vulkan_command_pool.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
|
||||
gnReturnCode gnCommandPoolAllocateCommandBuffersFn(gnCommandBufferHandle* commandBuffers, uint32_t count, struct gnCommandPool_t* pool) {
|
||||
gnReturnCode allocateCommandBuffers(gnCommandBufferHandle* commandBuffers, uint32_t count, gnCommandPool pool) {
|
||||
VkCommandBufferAllocateInfo allocInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
|
||||
.commandPool = pool->commandPool->commandPool,
|
||||
@@ -23,12 +23,12 @@ gnReturnCode gnCommandPoolAllocateCommandBuffersFn(gnCommandBufferHandle* comman
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
|
||||
void gnResetCommandBufferFn(struct gnCommandBuffer_t* commandBuffer) {
|
||||
void resetCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||
vkResetCommandBuffer(commandBuffer->commandBuffer->buffer, 0);
|
||||
}
|
||||
|
||||
|
||||
gnReturnCode gnBeginCommandBufferFn(struct gnCommandBuffer_t* commandBuffer) {
|
||||
gnReturnCode beginCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||
VkCommandBufferBeginInfo beginInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO
|
||||
};
|
||||
@@ -39,7 +39,7 @@ gnReturnCode gnBeginCommandBufferFn(struct gnCommandBuffer_t* commandBuffer) {
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
|
||||
gnReturnCode gnEndCommandBufferFn(struct gnCommandBuffer_t* commandBuffer) {
|
||||
gnReturnCode endCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||
if (vkEndCommandBuffer(commandBuffer->commandBuffer->buffer) != VK_SUCCESS)
|
||||
return GN_FAIELD_TO_END_RECORDING;
|
||||
return GN_SUCCESS;
|
||||
|
@@ -13,3 +13,9 @@ typedef struct gnPlatformCommandBuffer_t {
|
||||
|
||||
VkCommandBuffer VkBeginTransferOperation(VkDevice device, VkCommandPool pool);
|
||||
void VkEndTransferOperation(VkCommandBuffer transferBuffer, VkCommandPool pool, VkQueue syncQueue, VkDevice device);
|
||||
|
||||
|
||||
gnReturnCode allocateCommandBuffers(gnCommandBufferHandle* commandBuffers, uint32_t count, gnCommandPool pool);
|
||||
gnReturnCode beginCommandBuffer(gnCommandBufferHandle commandBuffer);
|
||||
void resetCommandBuffer(gnCommandBufferHandle commandBuffer);
|
||||
gnReturnCode endCommandBuffer(gnCommandBufferHandle commandBuffer);
|
||||
|
@@ -1,14 +1,6 @@
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "command/commands/gryphn_command.h"
|
||||
#include <renderpass/vulkan_render_pass_descriptor.h>
|
||||
#include "framebuffers/vulkan_framebuffer.h"
|
||||
#include "commands/command_buffer/vulkan_command_buffer.h"
|
||||
#include "pipelines/graphics_pipeline/vulkan_graphics_pipeline.h"
|
||||
#include "buffers/vulkan_buffer.h"
|
||||
#include "uniforms/vulkan_uniform.h"
|
||||
#include "shader_module/vulkan_shader_module.h"
|
||||
#include "vulkan_commands.h"
|
||||
|
||||
void gnCommandBeginRenderPassFn(gnCommandBuffer buffer, gnRenderPassInfo passInfo) {
|
||||
void beginRenderPass(gnCommandBuffer buffer, gnRenderPassInfo passInfo) {
|
||||
VkClearValue* values = malloc(sizeof(VkClearValue) * passInfo.clearValueCount);
|
||||
for (int i = 0; i < passInfo.clearValueCount; i++) {
|
||||
values[i] = (VkClearValue){{{
|
||||
@@ -33,14 +25,14 @@ void gnCommandBeginRenderPassFn(gnCommandBuffer buffer, gnRenderPassInfo passInf
|
||||
|
||||
vkCmdBeginRenderPass(buffer->commandBuffer->buffer, &renderPassInfo, VK_SUBPASS_CONTENTS_INLINE);
|
||||
}
|
||||
void gnCommandEndRenderPassFn(gnCommandBuffer buffer) {
|
||||
void endRenderPass(gnCommandBuffer buffer) {
|
||||
vkCmdEndRenderPass(buffer->commandBuffer->buffer);
|
||||
}
|
||||
void gnCommandBindGraphicsPipelineFn(gnCommandBuffer buffer, gnGraphicsPipeline graphicsPipeline) {
|
||||
void bindGraphicsPipeline(gnCommandBuffer buffer, gnGraphicsPipeline graphicsPipeline) {
|
||||
buffer->commandBuffer->boundGraphicsPipeline = graphicsPipeline;
|
||||
vkCmdBindPipeline(buffer->commandBuffer->buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, graphicsPipeline->graphicsPipeline->graphicsPipeline);
|
||||
}
|
||||
void gnCommandSetViewportFn(gnCommandBuffer buffer, gnViewport viewport) {
|
||||
void setViewport(gnCommandBuffer buffer, gnViewport viewport) {
|
||||
VkViewport vkViewport = {
|
||||
.x = viewport.position.x,
|
||||
.y = viewport.size.y,
|
||||
@@ -51,7 +43,7 @@ void gnCommandSetViewportFn(gnCommandBuffer buffer, gnViewport viewport) {
|
||||
};
|
||||
vkCmdSetViewport(buffer->commandBuffer->buffer, 0, 1, &vkViewport);
|
||||
}
|
||||
void gnCommandSetScissorFn(gnCommandBuffer buffer, gnScissor scissor) {
|
||||
void setScissor(gnCommandBuffer buffer, gnScissor scissor) {
|
||||
VkRect2D vkScissor = {
|
||||
.extent = { scissor.size.x, scissor.size.y },
|
||||
.offset = { scissor.position.x, scissor.position.y }
|
||||
@@ -59,7 +51,7 @@ void gnCommandSetScissorFn(gnCommandBuffer buffer, gnScissor scissor) {
|
||||
vkCmdSetScissor(buffer->commandBuffer->buffer, 0, 1, &vkScissor);
|
||||
}
|
||||
VkDeviceSize offsets[] = {0};
|
||||
void gnCommandBindBufferFn(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type) {
|
||||
void bindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type) {
|
||||
if (type == GN_VERTEX_BUFFER)
|
||||
vkCmdBindVertexBuffers(buffer->commandBuffer->buffer, 0, 1, &bufferToBind->buffer->buffer.buffer, offsets);
|
||||
else if (type == GN_INDEX_BUFFER) {
|
||||
@@ -67,16 +59,16 @@ void gnCommandBindBufferFn(gnCommandBufferHandle buffer, gnBufferHandle bufferTo
|
||||
buffer->commandBuffer->boundIndexBuffer = bufferToBind;
|
||||
}
|
||||
}
|
||||
void gnCommandDrawFn(gnCommandBuffer buffer, int vertexCount, int firstVertex, int instanceCount, int firstInstance) {
|
||||
void draw(gnCommandBuffer buffer, int vertexCount, int firstVertex, int instanceCount, int firstInstance) {
|
||||
vkCmdDraw(buffer->commandBuffer->buffer, vertexCount, instanceCount, firstVertex, firstInstance);
|
||||
}
|
||||
void gnCommandDrawIndexedFn(gnCommandBufferHandle buffer, gnIndexType type, int indexCount, int firstIndex, int vertexOffset, int instanceCount, int firstInstance) {
|
||||
void drawIndexed(gnCommandBufferHandle buffer, gnIndexType type, int indexCount, int firstIndex, int vertexOffset, int instanceCount, int firstInstance) {
|
||||
if (buffer->commandBuffer->changedBuffer) vkCmdBindIndexBuffer(buffer->commandBuffer->buffer, buffer->commandBuffer->boundIndexBuffer->buffer->buffer.buffer, 0, (type == GN_UINT32) ? VK_INDEX_TYPE_UINT32 : VK_INDEX_TYPE_UINT16);
|
||||
vkCmdDrawIndexed(buffer->commandBuffer->buffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
|
||||
buffer->commandBuffer->changedBuffer = gnFalse;
|
||||
}
|
||||
|
||||
void gnCommandBindUniformFn(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set) {
|
||||
void bindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set) {
|
||||
vkCmdBindDescriptorSets(
|
||||
buffer->commandBuffer->buffer,
|
||||
VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
@@ -85,7 +77,7 @@ void gnCommandBindUniformFn(gnCommandBufferHandle buffer, gnUniform uniform, uin
|
||||
);
|
||||
}
|
||||
|
||||
void gnCommandPushConstantFn(gnCommandBufferHandle buffer, gnPushConstantLayout layout, void* data) {
|
||||
void pushConstant(gnCommandBufferHandle buffer, gnPushConstantLayout layout, void* data) {
|
||||
vkCmdPushConstants(
|
||||
buffer->commandBuffer->buffer,
|
||||
buffer->commandBuffer->boundGraphicsPipeline->graphicsPipeline->pipelineLayout,
|
||||
|
21
projects/apis/vulkan/src/commands/commands/vulkan_commands.h
Normal file
21
projects/apis/vulkan/src/commands/commands/vulkan_commands.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "command/commands/gryphn_command.h"
|
||||
#include <renderpass/vulkan_render_pass_descriptor.h>
|
||||
#include <framebuffers/vulkan_framebuffer.h>
|
||||
#include <commands/command_buffer/vulkan_command_buffer.h>
|
||||
#include <pipelines/graphics_pipeline/vulkan_graphics_pipeline.h>
|
||||
#include <buffers/vulkan_buffer.h>
|
||||
#include <uniforms/vulkan_uniform.h>
|
||||
#include <shader_module/vulkan_shader_module.h>
|
||||
|
||||
void beginRenderPass(gnCommandBuffer buffer, gnRenderPassInfo passInfo);
|
||||
void endRenderPass(gnCommandBuffer buffer);
|
||||
void bindGraphicsPipeline(gnCommandBuffer buffer, gnGraphicsPipeline graphicsPipeline);
|
||||
void setViewport(gnCommandBuffer buffer, gnViewport viewport);
|
||||
void setScissor(gnCommandBuffer buffer, gnScissor scissor);
|
||||
void bindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type);
|
||||
void draw(gnCommandBuffer buffer, int vertexCount, int firstVertex, int instanceCount, int firstInstance);
|
||||
void drawIndexed(gnCommandBufferHandle buffer, gnIndexType type, int indexCount, int firstIndex, int vertexOffset, int instanceCount, int firstInstance);
|
||||
void bindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set);
|
||||
void pushConstant(gnCommandBufferHandle buffer, gnPushConstantLayout layout, void* data);
|
@@ -1,9 +1,6 @@
|
||||
#include "present/gryphn_present.h"
|
||||
#include "sync/semaphore/vulkan_semaphore.h"
|
||||
#include "presentation_queue/vulkan_presentation_queue.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
#include "vulkan_present.h"
|
||||
|
||||
gnReturnCode gnPresentFn(gnDevice device, gnPresentInfo info) {
|
||||
gnReturnCode present(gnDevice device, gnPresentInfo info) {
|
||||
VkSemaphore* waitSemaphores = malloc(sizeof(VkSemaphore) * info.waitCount);
|
||||
for (int i = 0; i < info.waitCount; i++) waitSemaphores[i] = info.waitSemaphores[i]->semaphore->semaphore;
|
||||
|
||||
|
6
projects/apis/vulkan/src/present/vulkan_present.h
Normal file
6
projects/apis/vulkan/src/present/vulkan_present.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "present/gryphn_present.h"
|
||||
#include <sync/semaphore/vulkan_semaphore.h>
|
||||
#include <presentation_queue/vulkan_presentation_queue.h>
|
||||
#include <output_device/vulkan_output_devices.h>
|
||||
|
||||
gnReturnCode present(gnDevice device, gnPresentInfo info);
|
@@ -1,13 +1,7 @@
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "submit/gryphn_submit.h"
|
||||
#include "sync/semaphore/vulkan_semaphore.h"
|
||||
#include "sync/fence/vulkan_fence.h"
|
||||
#include "commands/command_buffer/vulkan_command_buffer.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
#include "renderpass/vulkan_render_pass_descriptor.h"
|
||||
#include "vulkan_submit.h"
|
||||
|
||||
|
||||
gnReturnCode gnSubmitFn(gnDevice device, gnSubmitInfo info) {
|
||||
gnReturnCode submit(gnDevice device, gnSubmitInfo info) {
|
||||
VkSemaphore* waitSemaphores = malloc(sizeof(VkSemaphore) * info.waitCount);
|
||||
VkPipelineStageFlags* waitStages = malloc(sizeof(VkPipelineStageFlags) * info.waitCount);
|
||||
for (int i = 0; i < info.waitCount; i++) waitSemaphores[i] = info.waitSemaphores[i]->semaphore->semaphore;
|
||||
|
9
projects/apis/vulkan/src/submit/vulkan_submit.h
Normal file
9
projects/apis/vulkan/src/submit/vulkan_submit.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <submit/gryphn_submit.h>
|
||||
#include <sync/semaphore/vulkan_semaphore.h>
|
||||
#include <sync/fence/vulkan_fence.h>
|
||||
#include <commands/command_buffer/vulkan_command_buffer.h>
|
||||
#include <output_device/vulkan_output_devices.h>
|
||||
#include <renderpass/vulkan_render_pass_descriptor.h>
|
||||
|
||||
gnReturnCode submit(gnDevice device, gnSubmitInfo info);
|
@@ -1,7 +1,7 @@
|
||||
#include "vulkan_fence.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
|
||||
gnReturnCode gnCreateFenceFn(struct gnFence_t* fence, struct gnOutputDevice_t* device) {
|
||||
gnReturnCode createFence(gnFence fence, gnDevice device) {
|
||||
fence->fence = malloc(sizeof(gnPlatformFence));
|
||||
VkFenceCreateInfo fenceInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
|
||||
@@ -10,14 +10,13 @@ gnReturnCode gnCreateFenceFn(struct gnFence_t* fence, struct gnOutputDevice_t* d
|
||||
return GN_FAILED_TO_CREATE_FENCE;
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
void gnSignalFenceFn(struct gnFence_t* fence) {}
|
||||
void gnWaitForFenceFn(struct gnFence_t* fence, uint64_t timeout) {
|
||||
void waitForFence(gnFence fence, uint64_t timeout) {
|
||||
vkWaitForFences(fence->device->outputDevice->device, 1, &fence->fence->fence, VK_TRUE, timeout);
|
||||
}
|
||||
void gnResetFenceFn(struct gnFence_t* fence) {
|
||||
void resetFence(gnFence fence) {
|
||||
vkResetFences(fence->device->outputDevice->device, 1, &fence->fence->fence);
|
||||
}
|
||||
void gnDestroyFenceFn(struct gnFence_t* fence) {
|
||||
void destroyFence(gnFence fence) {
|
||||
vkDestroyFence(fence->device->outputDevice->device, fence->fence->fence, NULL);
|
||||
free(fence->fence);
|
||||
}
|
||||
|
@@ -5,3 +5,8 @@
|
||||
typedef struct gnPlatformFence_t {
|
||||
VkFence fence;
|
||||
} gnPlatformFence;
|
||||
|
||||
gnReturnCode createFence(gnFence fence, gnDevice device);
|
||||
void waitForFence(gnFence fence, uint64_t timeout);
|
||||
void resetFence(gnFence fence);
|
||||
void destroyFence(gnFence fence);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "vulkan_semaphore.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
|
||||
gnReturnCode gnCreateSemaphoreFn(struct gnSemaphore_t* semaphore, struct gnOutputDevice_t* device) {
|
||||
gnReturnCode createSemaphore(gnSemaphore semaphore, gnDevice device) {
|
||||
semaphore->semaphore = malloc(sizeof(gnPlatformSemaphore));
|
||||
VkSemaphoreCreateInfo semaphoreInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
|
||||
@@ -11,7 +11,7 @@ gnReturnCode gnCreateSemaphoreFn(struct gnSemaphore_t* semaphore, struct gnOutpu
|
||||
return GN_FAILED_TO_CREATE_SEMAPHORE;
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
void gnDestroySemaphoreFn(struct gnSemaphore_t* semaphore) {
|
||||
void destroySemaphore(gnSemaphore semaphore) {
|
||||
vkDestroySemaphore(semaphore->device->outputDevice->device, semaphore->semaphore->semaphore, NULL);
|
||||
free(semaphore->semaphore);
|
||||
}
|
||||
|
@@ -5,3 +5,6 @@
|
||||
typedef struct gnPlatformSemaphore_t {
|
||||
VkSemaphore semaphore;
|
||||
} gnPlatformSemaphore;
|
||||
|
||||
gnReturnCode createSemaphore(gnSemaphore semaphore, gnDevice device);
|
||||
void destroySemaphore(gnSemaphore semaphore);
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#include "uniforms/gryphn_uniform_pool.h"
|
||||
#include "textures/vulkan_texture.h"
|
||||
|
||||
void gnUpdateBufferUniformFn(gnUniform uniform, gnBufferUniformInfo* info) {
|
||||
void updateBufferUniform(gnUniform uniform, gnBufferUniformInfo* info) {
|
||||
VkDescriptorBufferInfo bufferInfo = {
|
||||
.buffer = info->buffer->buffer->buffer.buffer,
|
||||
.offset = info->offset,
|
||||
@@ -24,7 +24,7 @@ void gnUpdateBufferUniformFn(gnUniform uniform, gnBufferUniformInfo* info) {
|
||||
vkUpdateDescriptorSets(uniform->pool->device->outputDevice->device, 1, &write, 0, NULL);
|
||||
}
|
||||
|
||||
void gnUpdateImageUniformFn(gnUniform uniform, gnImageUniformInfo* info) {
|
||||
void updateImageUniform(gnUniform uniform, gnImageUniformInfo* info) {
|
||||
VkDescriptorImageInfo imageInfo = {
|
||||
.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||
.imageView = info->texture->texture->image.imageView,
|
||||
|
@@ -5,3 +5,6 @@
|
||||
typedef struct gnPlatformUniform_t {
|
||||
VkDescriptorSet set;
|
||||
} gnPlatformUniform;
|
||||
|
||||
void updateBufferUniform(gnUniform uniform, gnBufferUniformInfo* info);
|
||||
void updateImageUniform(gnUniform uniform, gnImageUniformInfo* info);
|
||||
|
Reference in New Issue
Block a user