move device functions over to loader
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "vulkan_command_pool.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
|
||||
gnReturnCode gnCreateCommandPoolFn(struct gnCommandPool_t* commandPool, struct gnOutputDevice_t* device, struct gnCommandPoolInfo_t info) {
|
||||
gnReturnCode gnCreateCommandPoolFn(struct gnCommandPool_t* commandPool, struct gnOutputDevice_t* device, gnCommandPoolInfo info) {
|
||||
commandPool->commandPool = malloc(sizeof(gnPlatformCommandPool));
|
||||
|
||||
VkCommandPoolCreateInfo poolInfo = {
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#include "uniforms/vulkan_uniform.h"
|
||||
#include "shader_module/vulkan_shader_module.h"
|
||||
|
||||
void gnCommandBeginRenderPassFn(gnCommandBuffer buffer, struct gnRenderPassInfo_t passInfo) {
|
||||
void gnCommandBeginRenderPassFn(gnCommandBuffer buffer, gnRenderPassInfo passInfo) {
|
||||
VkClearValue* values = malloc(sizeof(VkClearValue) * passInfo.clearValueCount);
|
||||
for (int i = 0; i < passInfo.clearValueCount; i++) {
|
||||
values[i] = (VkClearValue){{{
|
||||
@@ -51,7 +51,7 @@ void gnCommandSetViewportFn(gnCommandBuffer buffer, gnViewport viewport) {
|
||||
};
|
||||
vkCmdSetViewport(buffer->commandBuffer->buffer, 0, 1, &vkViewport);
|
||||
}
|
||||
void gnCommandSetScissorFn(gnCommandBuffer buffer, struct gnScissor_t scissor) {
|
||||
void gnCommandSetScissorFn(gnCommandBuffer buffer, gnScissor scissor) {
|
||||
VkRect2D vkScissor = {
|
||||
.extent = { scissor.size.x, scissor.size.y },
|
||||
.offset = { scissor.position.x, scissor.position.y }
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include "renderpass/vulkan_render_pass_descriptor.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
|
||||
gnReturnCode gnCreateFramebufferFn(struct gnFramebuffer_t* framebuffer, struct gnOutputDevice_t* device, struct gnFramebufferInfo_t info) {
|
||||
gnReturnCode gnCreateFramebufferFn(gnFramebuffer framebuffer, gnDevice device, gnFramebufferInfo info) {
|
||||
framebuffer->framebuffer = malloc(sizeof(struct gnPlatformFramebuffer_t));
|
||||
|
||||
VkImageView* attachments = malloc(sizeof(VkImageView) * info.attachmentCount);
|
||||
@@ -28,7 +28,7 @@ gnReturnCode gnCreateFramebufferFn(struct gnFramebuffer_t* framebuffer, struct g
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
|
||||
void gnDestroyFramebufferFn(struct gnFramebuffer_t* framebuffer) {
|
||||
void gnDestroyFramebufferFn(gnFramebuffer framebuffer) {
|
||||
vkDestroyFramebuffer(framebuffer->device->outputDevice->device, framebuffer->framebuffer->framebuffer, NULL);
|
||||
free(framebuffer->framebuffer);
|
||||
}
|
||||
|
@@ -4,10 +4,7 @@
|
||||
#include "renderpass/vulkan_render_pass_descriptor.h"
|
||||
#include "uniforms/vulkan_uniform_layout.h"
|
||||
|
||||
#include "stdio.h"
|
||||
|
||||
|
||||
VkDynamicState vkGryphnDynamicStateToVulkanDynamicState(enum gnDynamicState_e state) {
|
||||
VkDynamicState vkGryphnDynamicStateToVulkanDynamicState(gnDynamicState state) {
|
||||
switch (state) {
|
||||
case GN_DYNAMIC_VIEWPORT: return VK_DYNAMIC_STATE_VIEWPORT;
|
||||
case GN_DYNAMIC_SCISSOR: return VK_DYNAMIC_STATE_SCISSOR;
|
||||
@@ -26,7 +23,7 @@ VkPrimitiveTopology vkGryphnPrimitiveType(gnPrimitiveType primitiveType) {
|
||||
}
|
||||
}
|
||||
|
||||
VkPolygonMode vkGryphnPolygonMode(enum gnFillMode_e fillMode) {
|
||||
VkPolygonMode vkGryphnPolygonMode(gnFillMode fillMode) {
|
||||
switch (fillMode) {
|
||||
case GN_FILL_MODE_FILL: return VK_POLYGON_MODE_FILL;
|
||||
case GN_FILL_MODE_LINE: return VK_POLYGON_MODE_LINE;
|
||||
@@ -34,7 +31,7 @@ VkPolygonMode vkGryphnPolygonMode(enum gnFillMode_e fillMode) {
|
||||
}
|
||||
}
|
||||
|
||||
VkCullModeFlags vkGryphnCullMode(enum gnCullFace_e face) {
|
||||
VkCullModeFlags vkGryphnCullMode(gnCullFace face) {
|
||||
switch (face) {
|
||||
case GN_CULL_FACE_NONE: return VK_CULL_MODE_NONE;
|
||||
case GN_CULL_FACE_BACK: return VK_CULL_MODE_BACK_BIT;
|
||||
@@ -42,7 +39,7 @@ VkCullModeFlags vkGryphnCullMode(enum gnCullFace_e face) {
|
||||
}
|
||||
}
|
||||
|
||||
VkBlendFactor vkGryphnBlendFactor(enum gnBlendFactor_e factor) {
|
||||
VkBlendFactor vkGryphnBlendFactor(gnBlendFactor factor) {
|
||||
switch (factor) {
|
||||
case GN_BLEND_FACTOR_ZERO: return VK_BLEND_FACTOR_ZERO;
|
||||
case GN_BLEND_FACTOR_ONE: return VK_BLEND_FACTOR_ONE;
|
||||
@@ -51,7 +48,7 @@ VkBlendFactor vkGryphnBlendFactor(enum gnBlendFactor_e factor) {
|
||||
}
|
||||
}
|
||||
|
||||
VkBlendOp vkGryphnBlendOperation(enum gnBlendOperation_e operation) {
|
||||
VkBlendOp vkGryphnBlendOperation(gnBlendOperation operation) {
|
||||
switch(operation) {
|
||||
case GN_OPERATION_ADD: return VK_BLEND_OP_ADD;
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include "presentation_queue/vulkan_presentation_queue.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
|
||||
gnReturnCode gnPresentFn(struct gnOutputDevice_t* device, struct gnPresentInfo_t info) {
|
||||
gnReturnCode gnPresentFn(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;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include "sync/semaphore/vulkan_semaphore.h"
|
||||
#include "stdio.h"
|
||||
|
||||
gnReturnCode gnCreatePresentationQueueFn(gnPresentationQueueHandle presentationQueue, const gnOutputDeviceHandle device, struct gnPresentationQueueInfo_t presentationInfo) {
|
||||
gnReturnCode gnCreatePresentationQueueFn(gnPresentationQueueHandle presentationQueue, const gnDevice device, gnPresentationQueueInfo presentationInfo) {
|
||||
presentationQueue->presentationQueue = malloc(sizeof(struct gnPlatformPresentationQueue_t));
|
||||
|
||||
vkSwapchainSupportDetails details = vkGetSwapchainSupport(device->physicalDevice.physicalDevice->device, presentationInfo.surface->windowSurface->surface);
|
||||
|
@@ -7,9 +7,7 @@
|
||||
#include "renderpass/vulkan_render_pass_descriptor.h"
|
||||
|
||||
|
||||
gnReturnCode gnSubmitFn(struct gnOutputDevice_t* device, struct gnSubmitInfo_t info) {
|
||||
VK_SUBPASS_EXTERNAL;
|
||||
|
||||
gnReturnCode gnSubmitFn(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;
|
||||
|
Reference in New Issue
Block a user