finish vulkans support of return codes
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include "shader_module/vulkan_shader_module.h"
|
||||
#include "renderpass/vulkan_render_pass_descriptor.h"
|
||||
#include "uniforms/vulkan_uniform_layout.h"
|
||||
|
||||
#include "vulkan_result_converter.h"
|
||||
|
||||
VkDynamicState vkGryphnDynamicStateToVulkanDynamicState(gnDynamicState state) {
|
||||
switch (state) {
|
||||
@@ -257,8 +257,9 @@ gnReturnCode createGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gnDevic
|
||||
pipelineLayoutInfo.pPushConstantRanges = graphicsPipeline->graphicsPipeline->ranges
|
||||
};
|
||||
|
||||
if (vkCreatePipelineLayout(device->outputDevice->device, &pipelineLayoutInfo, NULL, &graphicsPipeline->graphicsPipeline->pipelineLayout) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_CREATE_UNIFORM_LAYOUT;
|
||||
VkResult pipelineCode = vkCreatePipelineLayout(device->outputDevice->device, &pipelineLayoutInfo, NULL, &graphicsPipeline->graphicsPipeline->pipelineLayout);
|
||||
if (pipelineCode!= VK_SUCCESS)
|
||||
return VkResultToGnReturnCode(pipelineCode);
|
||||
|
||||
graphicsPipeline->graphicsPipeline->modules = malloc(sizeof(VkPipelineShaderStageCreateInfo) * info.shaderModuleCount);
|
||||
for (int i = 0; i < info.shaderModuleCount; i++) {
|
||||
@@ -284,10 +285,7 @@ gnReturnCode createGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gnDevic
|
||||
.basePipelineIndex = -1,
|
||||
};
|
||||
|
||||
if (vkCreateGraphicsPipelines(device->outputDevice->device, VK_NULL_HANDLE, 1, &pipelineInfo, NULL, &graphicsPipeline->graphicsPipeline->graphicsPipeline) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_CREATE_GRAPHICS_PIPELINE;
|
||||
|
||||
return GN_SUCCESS;
|
||||
return VkResultToGnReturnCode(vkCreateGraphicsPipelines(device->outputDevice->device, VK_NULL_HANDLE, 1, &pipelineInfo, NULL, &graphicsPipeline->graphicsPipeline->graphicsPipeline));
|
||||
}
|
||||
|
||||
void destroyGraphicsPipeline(gnGraphicsPipeline graphicsPipeline) {
|
||||
@@ -298,7 +296,6 @@ void destroyGraphicsPipeline(gnGraphicsPipeline graphicsPipeline) {
|
||||
for (int i = 0; i < graphicsPipeline->graphicsPipeline->setCount; i++)
|
||||
vkDestroyDescriptorSetLayout(graphicsPipeline->device->outputDevice->device, graphicsPipeline->graphicsPipeline->sets[i], NULL);
|
||||
free(graphicsPipeline->graphicsPipeline->modules);
|
||||
|
||||
vkDestroyPipeline(graphicsPipeline->device->outputDevice->device, graphicsPipeline->graphicsPipeline->graphicsPipeline, NULL);
|
||||
vkDestroyPipelineLayout(graphicsPipeline->device->outputDevice->device, graphicsPipeline->graphicsPipeline->pipelineLayout, NULL);
|
||||
free(graphicsPipeline->graphicsPipeline);
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "vulkan_present.h"
|
||||
#include "extensions/synchronization/commands/gryphn_sync_present.h"
|
||||
#include "vulkan_surface/vulkan_surface.h"
|
||||
#include "vulkan_result_converter.h"
|
||||
|
||||
gnReturnCode vulkanQueuePresentSync(gnDevice device, gnQueue queue, gnPresentSyncInfo info) {
|
||||
VkSemaphore* waitSemaphores = malloc(sizeof(VkSemaphore) * info.waitCount);
|
||||
@@ -18,10 +19,7 @@ gnReturnCode vulkanQueuePresentSync(gnDevice device, gnQueue queue, gnPresentSyn
|
||||
.pImageIndices = info.imageIndices
|
||||
};
|
||||
|
||||
VkResult result = vkQueuePresentKHR((VkQueue)queue, &presentInfo);
|
||||
if (result == VK_ERROR_OUT_OF_DATE_KHR) return GN_OUT_OF_DATE_PRESENTATION_QUEUE;
|
||||
if (result == VK_SUBOPTIMAL_KHR) return GN_SUBOPTIMAL_PRESENTATION_QUEUE;
|
||||
return GN_SUCCESS;
|
||||
return VkResultToGnReturnCode(vkQueuePresentKHR((VkQueue)queue, &presentInfo));
|
||||
}
|
||||
|
||||
gnReturnCode vulkanPresentSync(gnDevice device, gnPresentSyncInfo info) {
|
||||
@@ -41,10 +39,7 @@ gnReturnCode vulkanQueuePresent(gnDevice device, gnQueue queue, gnPresentInfo in
|
||||
.pImageIndices = info.imageIndices
|
||||
};
|
||||
|
||||
VkResult result = vkQueuePresentKHR((VkQueue)queue, &presentInfo);
|
||||
if (result == VK_ERROR_OUT_OF_DATE_KHR) return GN_OUT_OF_DATE_PRESENTATION_QUEUE;
|
||||
if (result == VK_SUBOPTIMAL_KHR) return GN_SUBOPTIMAL_PRESENTATION_QUEUE;
|
||||
return GN_SUCCESS;
|
||||
return VkResultToGnReturnCode(vkQueuePresentKHR((VkQueue)queue, &presentInfo));
|
||||
}
|
||||
|
||||
gnReturnCode vulkanPresent(gnDevice device, gnPresentInfo info) {
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#include "vulkan_surface/vulkan_surface.h"
|
||||
#include "textures/vulkan_texture.h"
|
||||
#include "sync/semaphore/vulkan_semaphore.h"
|
||||
#include "stdio.h"
|
||||
#include <vulkan_result_converter.h>
|
||||
|
||||
gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue, const gnDevice device, gnPresentationQueueInfo presentationInfo) {
|
||||
presentationQueue->presentationQueue = malloc(sizeof(struct gnPlatformPresentationQueue_t));
|
||||
@@ -55,9 +55,7 @@ gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue
|
||||
createInfo.oldSwapchain = VK_NULL_HANDLE;
|
||||
|
||||
VkResult result = vkCreateSwapchainKHR(device->outputDevice->device, &createInfo, NULL, &presentationQueue->presentationQueue->swapChain);
|
||||
if (result == VK_ERROR_NATIVE_WINDOW_IN_USE_KHR) return GN_WINDOW_IN_USE;
|
||||
if (result != VK_SUCCESS)
|
||||
return GN_FAILED_TO_CREATE_PRESENTATION_QUEUE;
|
||||
if (result != VK_SUCCESS) return VkResultToGnReturnCode(result);
|
||||
|
||||
vkGetSwapchainImagesKHR(device->outputDevice->device, presentationQueue->presentationQueue->swapChain, &presentationQueue->imageCount, NULL);
|
||||
presentationQueue->presentationQueue->swapChainImages = malloc(sizeof(VkImage) * presentationQueue->imageCount);
|
||||
@@ -83,14 +81,15 @@ gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue
|
||||
presentationQueue->images[i] = malloc(sizeof(struct gnTexture_t));
|
||||
presentationQueue->images[i]->texture = malloc(sizeof(gnPlatformTexture));
|
||||
imageViewCreateInfo.image = presentationQueue->presentationQueue->swapChainImages[i];
|
||||
if (vkCreateImageView(device->outputDevice->device, &imageViewCreateInfo, NULL, &presentationQueue->presentationQueue->swapChainImageViews[i]) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_CREATE_IMAGE_VIEW;
|
||||
VkResult creatingImageViewResult = vkCreateImageView(device->outputDevice->device, &imageViewCreateInfo, NULL, &presentationQueue->presentationQueue->swapChainImageViews[i]);
|
||||
if (creatingImageViewResult != VK_SUCCESS)
|
||||
return VkResultToGnReturnCode(creatingImageViewResult);
|
||||
|
||||
presentationQueue->images[i]->texture->image.image = presentationQueue->presentationQueue->swapChainImages[i];
|
||||
presentationQueue->images[i]->texture->image.imageView = presentationQueue->presentationQueue->swapChainImageViews[i];
|
||||
}
|
||||
|
||||
return GN_SUCCESS;
|
||||
return VkResultToGnReturnCode(result);
|
||||
}
|
||||
|
||||
gnReturnCode getVulkanPresentQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t* imageIndex) {
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include "vulkan_surface/vulkan_surface.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
#include <output_device/vulkan_physical_device.h>
|
||||
#include "stdio.h"
|
||||
#include <vulkan_result_converter.h>
|
||||
|
||||
VkAttachmentLoadOp vkGryphnLoadOperation(gnLoadOperation loadOperation) {
|
||||
switch(loadOperation) {
|
||||
@@ -130,18 +130,11 @@ gnReturnCode createRenderPass(gnRenderPassDescriptor renderPass, gnDevice device
|
||||
.dependencyCount = info.dependencyCount,
|
||||
.pDependencies = renderPass->renderPassDescriptor->dependencies,
|
||||
};
|
||||
|
||||
if (vkCreateRenderPass(device->outputDevice->device, &renderPassInfo, NULL, &renderPass->renderPassDescriptor->renderPass) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_CREATE_RENDER_PASS;
|
||||
|
||||
return GN_SUCCESS;
|
||||
return VkResultToGnReturnCode(vkCreateRenderPass(device->outputDevice->device, &renderPassInfo, NULL, &renderPass->renderPassDescriptor->renderPass));
|
||||
}
|
||||
|
||||
|
||||
void destroyRenderPass(gnRenderPassDescriptor renderPass) {
|
||||
vkDestroyRenderPass(renderPass->device->outputDevice->device, renderPass->renderPassDescriptor->renderPass, NULL);
|
||||
|
||||
|
||||
free(renderPass->renderPassDescriptor->attachments);
|
||||
free(renderPass->renderPassDescriptor->subpasses);
|
||||
free(renderPass->renderPassDescriptor->dependencies);
|
||||
|
@@ -1,37 +1,33 @@
|
||||
#include "vulkan_shader_module.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
#include "stdio.h"
|
||||
#include "vulkan_result_converter.h"
|
||||
|
||||
VkShaderStageFlagBits vkGryphnShaderModuleStage(gnShaderModuleStage stage) {
|
||||
VkShaderStageFlagBits outStage = 0;
|
||||
|
||||
if ((stage & GN_VERTEX_SHADER_MODULE) == GN_VERTEX_SHADER_MODULE) outStage |= VK_SHADER_STAGE_VERTEX_BIT;
|
||||
if ((stage & GN_FRAGMENT_SHADER_MODULE) == GN_FRAGMENT_SHADER_MODULE) outStage |= VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||
if ((stage & GN_ALL_SHADER_MODULE) == GN_ALL_SHADER_MODULE) return VK_SHADER_STAGE_ALL_GRAPHICS;
|
||||
|
||||
return outStage;
|
||||
}
|
||||
|
||||
gnReturnCode createShaderModule(gnShaderModule module, gnDevice device, gnShaderModuleInfo shaderModuleInfo) {
|
||||
module->shaderModule = malloc(sizeof(struct gnPlatformShaderModule_t));
|
||||
|
||||
VkShaderModuleCreateInfo createInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
|
||||
.codeSize = shaderModuleInfo.size,
|
||||
.pCode = shaderModuleInfo.code
|
||||
};
|
||||
VkResult result = vkCreateShaderModule(device->outputDevice->device, &createInfo, NULL, &module->shaderModule->shaderModule);
|
||||
if (result == VK_SUCCESS) {
|
||||
module->shaderModule->shaderStageInfo = (VkPipelineShaderStageCreateInfo){
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
|
||||
.stage = vkGryphnShaderModuleStage(shaderModuleInfo.stage),
|
||||
.module = module->shaderModule->shaderModule,
|
||||
.pName = gnToCString(shaderModuleInfo.entryPoint)
|
||||
};
|
||||
}
|
||||
|
||||
if (vkCreateShaderModule(device->outputDevice->device, &createInfo, NULL, &module->shaderModule->shaderModule) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_CREATE_SHADER_MODULE;
|
||||
|
||||
module->shaderModule->shaderStageInfo = (VkPipelineShaderStageCreateInfo){
|
||||
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
|
||||
.stage = vkGryphnShaderModuleStage(shaderModuleInfo.stage),
|
||||
.module = module->shaderModule->shaderModule,
|
||||
.pName = gnToCString(shaderModuleInfo.entryPoint)
|
||||
};
|
||||
|
||||
return GN_SUCCESS;
|
||||
return VkResultToGnReturnCode(result);
|
||||
}
|
||||
|
||||
void destroyShaderModule(gnShaderModule module) {
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#include "vulkan_submit.h"
|
||||
#include "vulkan_result_converter.h"
|
||||
|
||||
gnReturnCode vulkanSubmitSyncQueue(gnOutputDevice device, gnQueue queue, gnSubmitSyncInfo info) {
|
||||
VkSemaphore* waitSemaphores = malloc(sizeof(VkSemaphore) * info.waitCount);
|
||||
@@ -23,18 +24,7 @@ gnReturnCode vulkanSubmitSyncQueue(gnOutputDevice device, gnQueue queue, gnSubmi
|
||||
.pSignalSemaphores = signalSemaphores
|
||||
};
|
||||
|
||||
if (vkQueueSubmit((VkQueue)queue, 1, &submitInfo, info.fence->fence->fence) != VK_SUCCESS) {
|
||||
free(waitSemaphores);
|
||||
free(waitStages);
|
||||
free(commandBuffers);
|
||||
free(signalSemaphores);
|
||||
return GN_FAILED_TO_SUBMIT_COMMAND_BUFFER;
|
||||
}
|
||||
free(waitSemaphores);
|
||||
free(waitStages);
|
||||
free(commandBuffers);
|
||||
free(signalSemaphores);
|
||||
return GN_SUCCESS;
|
||||
return VkResultToGnReturnCode(vkQueueSubmit((VkQueue)queue, 1, &submitInfo, info.fence->fence->fence));
|
||||
}
|
||||
|
||||
gnReturnCode vulkanSubmitSync(gnDevice device, gnSubmitSyncInfo info) {
|
||||
@@ -57,10 +47,11 @@ gnReturnCode vulkanSubmitQueue(gnOutputDevice device, gnQueue queue, gnSubmitInf
|
||||
};
|
||||
|
||||
vkResetFences(device->outputDevice->device, 1, &device->outputDevice->barrierFence);
|
||||
if (vkQueueSubmit((VkQueue)queue, 1, &submitInfo, device->outputDevice->barrierFence) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_SUBMIT_COMMAND_BUFFER;
|
||||
VkResult res = vkQueueSubmit((VkQueue)queue, 1, &submitInfo, device->outputDevice->barrierFence);
|
||||
if (res != VK_SUCCESS)
|
||||
return VkResultToGnReturnCode(res);
|
||||
vkWaitForFences(device->outputDevice->device, 1, &device->outputDevice->barrierFence, VK_TRUE, UINT64_MAX);
|
||||
return GN_SUCCESS;
|
||||
return VkResultToGnReturnCode(res);
|
||||
}
|
||||
|
||||
gnReturnCode vulkanSubmit(gnDevice device, gnSubmitInfo info) {
|
||||
|
@@ -1,15 +1,13 @@
|
||||
#include "vulkan_fence.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
#include <vulkan_result_converter.h>
|
||||
|
||||
gnReturnCode createFence(gnFence fence, gnDevice device) {
|
||||
fence->fence = malloc(sizeof(gnPlatformFence));
|
||||
VkFenceCreateInfo fenceInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO
|
||||
};
|
||||
|
||||
if (vkCreateFence(device->outputDevice->device, &fenceInfo, NULL, &fence->fence->fence) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_CREATE_FENCE;
|
||||
return GN_SUCCESS;
|
||||
return VkResultToGnReturnCode(vkCreateFence(device->outputDevice->device, &fenceInfo, NULL, &fence->fence->fence));
|
||||
}
|
||||
void waitForFence(gnFence fence, uint64_t timeout) {
|
||||
vkWaitForFences(fence->device->outputDevice->device, 1, &fence->fence->fence, VK_TRUE, timeout);
|
||||
|
@@ -1,15 +1,13 @@
|
||||
#include "vulkan_semaphore.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
#include <vulkan_result_converter.h>
|
||||
|
||||
gnReturnCode createSemaphore(gnSemaphore semaphore, gnDevice device) {
|
||||
semaphore->semaphore = malloc(sizeof(gnPlatformSemaphore));
|
||||
VkSemaphoreCreateInfo semaphoreInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
|
||||
};
|
||||
|
||||
if (vkCreateSemaphore(device->outputDevice->device, &semaphoreInfo, NULL, &semaphore->semaphore->semaphore))
|
||||
return GN_FAILED_TO_CREATE_SEMAPHORE;
|
||||
return GN_SUCCESS;
|
||||
return VkResultToGnReturnCode(vkCreateSemaphore(device->outputDevice->device, &semaphoreInfo, NULL, &semaphore->semaphore->semaphore));
|
||||
}
|
||||
void destroySemaphore(gnSemaphore semaphore) {
|
||||
vkDestroySemaphore(semaphore->device->outputDevice->device, semaphore->semaphore->semaphore, NULL);
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "vulkan_texture.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
#include "output_device/vulkan_physical_device.h"
|
||||
#include <vulkan_result_converter.h>
|
||||
|
||||
VkImageType vkGryphnTextureType(gnTextureType type) {
|
||||
switch(type) {
|
||||
@@ -150,7 +151,7 @@ gnReturnCode createTexture(gnTexture texture, gnDevice device, const gnTextureIn
|
||||
&texture->texture->buffer, imageSize, device,
|
||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, VK_BUFFER_USAGE_TRANSFER_SRC_BIT
|
||||
);
|
||||
if (staginBufferCreateCode != GN_SUCCESS) return GN_FAILED_TO_CREATE_BUFFER;
|
||||
if (staginBufferCreateCode != GN_SUCCESS) return staginBufferCreateCode;
|
||||
texture->texture->size = imageSize;
|
||||
|
||||
VkImageCreateInfo imageInfo = {
|
||||
@@ -172,8 +173,7 @@ gnReturnCode createTexture(gnTexture texture, gnDevice device, const gnTextureIn
|
||||
};
|
||||
|
||||
VkResult res = vkCreateImage(device->outputDevice->device, &imageInfo, NULL, &texture->texture->image.image);
|
||||
if (res == VK_ERROR_FORMAT_NOT_SUPPORTED) return GN_UNSUPPORTED_IMAGE_FORMAT;
|
||||
else if (res != VK_SUCCESS) return GN_FAILED_TO_CREATE_IMAGE;
|
||||
if (res != VK_SUCCESS) return VkResultToGnReturnCode(res);
|
||||
|
||||
VkMemoryRequirements memRequirements;
|
||||
vkGetImageMemoryRequirements(device->outputDevice->device, texture->texture->image.image, &memRequirements);
|
||||
@@ -186,9 +186,8 @@ gnReturnCode createTexture(gnTexture texture, gnDevice device, const gnTextureIn
|
||||
};
|
||||
if (!foundMemory) return GN_FAILED_TO_ALLOCATE_MEMORY;
|
||||
|
||||
if (vkAllocateMemory(device->outputDevice->device, &allocInfo, NULL, &texture->texture->image.memory) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_ALLOCATE_MEMORY;
|
||||
|
||||
VkResult allocationRes = vkAllocateMemory(device->outputDevice->device, &allocInfo, NULL, &texture->texture->image.memory);
|
||||
if (allocationRes != VK_SUCCESS) return VkResultToGnReturnCode(allocationRes);
|
||||
vkBindImageMemory(device->outputDevice->device, texture->texture->image.image, texture->texture->image.memory, 0);
|
||||
|
||||
texture->texture->beenWrittenToo = GN_FALSE;
|
||||
@@ -206,8 +205,8 @@ gnReturnCode createTexture(gnTexture texture, gnDevice device, const gnTextureIn
|
||||
.subresourceRange.layerCount = 1,
|
||||
};
|
||||
|
||||
if (vkCreateImageView(device->outputDevice->device, &viewInfo, NULL, &texture->texture->image.imageView) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_CREATE_IMAGE_VIEW;
|
||||
VkResult image_view = vkCreateImageView(device->outputDevice->device, &viewInfo, NULL, &texture->texture->image.imageView);
|
||||
if (image_view != VK_SUCCESS) return VkResultToGnReturnCode(image_view);
|
||||
|
||||
VkPhysicalDeviceProperties properties = {};
|
||||
vkGetPhysicalDeviceProperties(device->physicalDevice->physicalDevice->device, &properties);
|
||||
@@ -235,13 +234,10 @@ gnReturnCode createTexture(gnTexture texture, gnDevice device, const gnTextureIn
|
||||
.maxLod = 0.0f,
|
||||
};
|
||||
|
||||
if (vkCreateSampler(device->outputDevice->device, &samplerInfo, NULL, &texture->texture->sampler) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_CREATE_SAMPLER;
|
||||
|
||||
if (vkGryphnIsDepthStencil(info.format))
|
||||
VkTransitionImageLayout(texture->device, texture->texture->image.image, texture->info.format, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
|
||||
|
||||
return GN_SUCCESS;
|
||||
return VkResultToGnReturnCode(vkCreateSampler(device->outputDevice->device, &samplerInfo, NULL, &texture->texture->sampler));
|
||||
}
|
||||
|
||||
void textureData(gnTextureHandle texture, void* pixelData) {
|
||||
|
@@ -20,7 +20,7 @@ static inline gnReturnCode VkResultToGnReturnCode(VkResult result) {
|
||||
// case VK_ERROR_FEATURE_NOT_PRESENT: return ;
|
||||
// case VK_ERROR_INCOMPATIBLE_DRIVER: return ;
|
||||
// case VK_ERROR_TOO_MANY_OBJECTS: return ;
|
||||
// case VK_ERROR_FORMAT_NOT_SUPPORTED: return ;
|
||||
case VK_ERROR_FORMAT_NOT_SUPPORTED: return GN_UNSUPPORTED_FORMAT;
|
||||
// case VK_ERROR_FRAGMENTED_POOL: return ;
|
||||
case VK_ERROR_UNKNOWN: return GN_UNKNOWN_ERROR;
|
||||
// case VK_ERROR_OUT_OF_POOL_MEMORY: return ;
|
||||
@@ -31,27 +31,27 @@ static inline gnReturnCode VkResultToGnReturnCode(VkResult result) {
|
||||
// case VK_ERROR_NOT_PERMITTED: return ;
|
||||
// case VK_ERROR_SURFACE_LOST_KHR: return ;
|
||||
// case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: return ;
|
||||
// case VK_SUBOPTIMAL_KHR: return ;
|
||||
// case VK_ERROR_OUT_OF_DATE_KHR: return ;
|
||||
case VK_SUBOPTIMAL_KHR: return GN_SUBOPTIMAL_PRESENTATION_QUEUE;
|
||||
case VK_ERROR_OUT_OF_DATE_KHR: return GN_OUT_OF_DATE_PRESENTATION_QUEUE;
|
||||
// case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: return ;
|
||||
case VK_ERROR_VALIDATION_FAILED_EXT: return GN_UNKNOWN_ERROR;
|
||||
case VK_ERROR_INVALID_SHADER_NV: return GN_UNKNOWN_ERROR;
|
||||
case VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR: return GN_UNKNOWN_ERROR;
|
||||
case VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR: return GN_UNKNOWN_ERROR;
|
||||
case VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR: return GN_UNKNOWN_ERROR;
|
||||
case VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR: return GN_UNKNOWN_ERROR;
|
||||
case VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR: return GN_UNKNOWN_ERROR;
|
||||
case VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR: return GN_UNKNOWN_ERROR;
|
||||
case VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT: return GN_UNKNOWN_ERROR;
|
||||
case VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT: return GN_UNKNOWN_ERROR;
|
||||
case VK_THREAD_IDLE_KHR: return GN_UNKNOWN_ERROR;
|
||||
case VK_THREAD_DONE_KHR: return GN_UNKNOWN_ERROR;
|
||||
case VK_OPERATION_DEFERRED_KHR: return GN_UNKNOWN_ERROR;
|
||||
case VK_OPERATION_NOT_DEFERRED_KHR: return GN_UNKNOWN_ERROR;
|
||||
case VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR: return GN_UNKNOWN_ERROR;
|
||||
case VK_ERROR_COMPRESSION_EXHAUSTED_EXT: return GN_UNKNOWN_ERROR;
|
||||
case VK_INCOMPATIBLE_SHADER_BINARY_EXT: return GN_UNKNOWN_ERROR;
|
||||
case VK_PIPELINE_BINARY_MISSING_KHR: return GN_UNKNOWN_ERROR;
|
||||
case VK_ERROR_NOT_ENOUGH_SPACE_KHR: return GN_UNKNOWN_ERROR;
|
||||
// case VK_ERROR_VALIDATION_FAILED_EXT: return GN_UNKNOWN_ERROR;
|
||||
// case VK_ERROR_INVALID_SHADER_NV: return GN_UNKNOWN_ERROR;
|
||||
// case VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR: return GN_UNKNOWN_ERROR;
|
||||
// case VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR: return GN_UNKNOWN_ERROR;
|
||||
// case VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR: return GN_UNKNOWN_ERROR;
|
||||
// case VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR: return GN_UNKNOWN_ERROR;
|
||||
// case VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR: return GN_UNKNOWN_ERROR;
|
||||
// case VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR: return GN_UNKNOWN_ERROR;
|
||||
// case VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT: return GN_UNKNOWN_ERROR;
|
||||
// case VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT: return GN_UNKNOWN_ERROR;
|
||||
// case VK_THREAD_IDLE_KHR: return GN_UNKNOWN_ERROR;
|
||||
// case VK_THREAD_DONE_KHR: return GN_UNKNOWN_ERROR;
|
||||
// case VK_OPERATION_DEFERRED_KHR: return GN_UNKNOWN_ERROR;
|
||||
// case VK_OPERATION_NOT_DEFERRED_KHR: return GN_UNKNOWN_ERROR;
|
||||
// case VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR: return GN_UNKNOWN_ERROR;
|
||||
// case VK_ERROR_COMPRESSION_EXHAUSTED_EXT: return GN_UNKNOWN_ERROR;
|
||||
// case VK_INCOMPATIBLE_SHADER_BINARY_EXT: return GN_UNKNOWN_ERROR;
|
||||
// case VK_PIPELINE_BINARY_MISSING_KHR: return GN_UNKNOWN_ERROR;
|
||||
// case VK_ERROR_NOT_ENOUGH_SPACE_KHR: return GN_UNKNOWN_ERROR;
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#import <QuartzCore/CAMetalLayer.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
#include "vulkan_result_converter.h"
|
||||
|
||||
#include "vulkan/vulkan_metal.h"
|
||||
gnReturnCode createMacOSWindowSurface(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, gnMacOSWindowSurfaceInfo createInfo) {
|
||||
@@ -18,10 +18,6 @@ gnReturnCode createMacOSWindowSurface(gnWindowSurfaceHandle windowSurface, gnIns
|
||||
surfaceCreateInfo.pNext = NULL;
|
||||
surfaceCreateInfo.flags = 0;
|
||||
surfaceCreateInfo.pLayer = createInfo.layer;
|
||||
|
||||
VkResult result = vkCreateMetalSurfaceEXT(instance->instance->vk_instance, &surfaceCreateInfo, NULL, &windowSurface->windowSurface->surface);
|
||||
if (result != VK_SUCCESS)
|
||||
return GN_FAILED_TO_ATTACH_WINDOW;
|
||||
return GN_SUCCESS;
|
||||
return VkResultToGnReturnCode(vkCreateMetalSurfaceEXT(instance->instance->vk_instance, &surfaceCreateInfo, NULL, &windowSurface->windowSurface->surface));
|
||||
}
|
||||
#endif
|
||||
|
@@ -7,7 +7,9 @@ typedef enum gnReturnCode {
|
||||
// non spec return codes
|
||||
GN_FAILED_CREATE_OBJECT, GN_FAILED_TO_ALLOCATE_OBJECT,
|
||||
GN_FAILED_TO_ALLOCATE_MEMORY, GN_OUT_OUT_HOST_MEMEORY,
|
||||
GN_OUT_OUT_DEVICE_MEMORY,
|
||||
GN_OUT_OUT_DEVICE_MEMORY, GN_OUT_OF_DATE_PRESENTATION_QUEUE,
|
||||
GN_SUBOPTIMAL_PRESENTATION_QUEUE, GN_SURFACE_IN_USE, GN_UNSUPPORTED_FORMAT,
|
||||
GN_FAILED_TO_FIND_ENTRY_POINT,
|
||||
|
||||
|
||||
GN_UNLOADED_EXTENSION = -1,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include "utils/gryphn_error_code.h"
|
||||
#include "core/gryphn_return_code.h"
|
||||
#include "uniforms/gryphn_uniform_layout.h"
|
||||
#include "uniforms/gryphn_uniform.h"
|
||||
#include "gryphn_handles.h"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "stdint.h"
|
||||
#include "utils/gryphn_error_code.h"
|
||||
#include "core/gryphn_return_code.h"
|
||||
#include "gryphn_handles.h"
|
||||
|
||||
typedef struct gnPresentSyncInfo {
|
||||
|
Reference in New Issue
Block a user