fix vulkan's usage of removed error primative
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit
Some checks failed
pyrite-dev/milsko/pipeline/head There was a failure building this commit
This commit is contained in:
parent
af54b3e515
commit
b6b8f742d7
3 changed files with 25 additions and 58 deletions
|
|
@ -231,43 +231,16 @@ void vulkan_setup(MwWidget handle) {
|
|||
VkSemaphoreCreateInfo semaphoreInfo = {};
|
||||
VkFenceCreateInfo fenceInfo = {};
|
||||
|
||||
MwErrorEnum err = MwEsuccess;
|
||||
int err = 0;
|
||||
_vkGetInstanceProcAddr = MwVulkanGetField(handle, MwVulkanField_GetInstanceProcAddr, &err);
|
||||
if(err != MwEsuccess) {
|
||||
printf("Error getting vkGetInstanceProcAddr!\n%s\n", MwGetLastError());
|
||||
}
|
||||
instance = MwVulkanGetField(handle, MwVulkanField_Instance, &err);
|
||||
if(err != MwEsuccess) {
|
||||
printf("Error getting vulkan instance!\n%s\n", MwGetLastError());
|
||||
}
|
||||
device = MwVulkanGetField(handle, MwVulkanField_LogicalDevice, &err);
|
||||
if(err != MwEsuccess) {
|
||||
printf("Error getting VkDevice!\n%s\n", MwGetLastError());
|
||||
}
|
||||
physicalDevice = MwVulkanGetField(handle, MwVulkanField_PhysicalDevice, &err);
|
||||
if(err != MwEsuccess) {
|
||||
printf("Error getting physical device!\n%s\n", MwGetLastError());
|
||||
}
|
||||
graphicsQueue = MwVulkanGetField(handle, MwVulkanField_GraphicsQueue, &err);
|
||||
if(err != MwEsuccess) {
|
||||
printf("Error getting graphics queue!\n%s\n", MwGetLastError());
|
||||
}
|
||||
presentQueue = MwVulkanGetField(handle, MwVulkanField_PresentQueue, &err);
|
||||
if(err != MwEsuccess) {
|
||||
printf("Error getting present queue!\n%s\n", MwGetLastError());
|
||||
}
|
||||
surface = MwVulkanGetField(handle, MwVulkanField_Surface, &err);
|
||||
if(err != MwEsuccess) {
|
||||
printf("Error getting surface!\n%s\n", MwGetLastError());
|
||||
}
|
||||
presentQueueIndex = MwVulkanGetField(handle, MwVulkanField_PresentQueueIndex, &err);
|
||||
if(err != MwEsuccess) {
|
||||
printf("Error getting present queue index!\n%s\n", MwGetLastError());
|
||||
}
|
||||
graphicsQueueIndex = MwVulkanGetField(handle, MwVulkanField_GraphicsQueueIndex, &err);
|
||||
if(err != MwEsuccess) {
|
||||
printf("Error getting graphics queue index!\n%s\n", MwGetLastError());
|
||||
}
|
||||
instance = MwVulkanGetField(handle, MwVulkanField_Instance, &err);
|
||||
device = MwVulkanGetField(handle, MwVulkanField_LogicalDevice, &err);
|
||||
physicalDevice = MwVulkanGetField(handle, MwVulkanField_PhysicalDevice, &err);
|
||||
graphicsQueue = MwVulkanGetField(handle, MwVulkanField_GraphicsQueue, &err);
|
||||
presentQueue = MwVulkanGetField(handle, MwVulkanField_PresentQueue, &err);
|
||||
surface = MwVulkanGetField(handle, MwVulkanField_Surface, &err);
|
||||
presentQueueIndex = MwVulkanGetField(handle, MwVulkanField_PresentQueueIndex, &err);
|
||||
graphicsQueueIndex = MwVulkanGetField(handle, MwVulkanField_GraphicsQueueIndex, &err);
|
||||
|
||||
LOAD_VK_FUNCTION(vkCreateShaderModule);
|
||||
LOAD_VK_FUNCTION(vkCreatePipelineLayout);
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ typedef enum MwVulkanField_T {
|
|||
* @brief Function for getting a field from within Vulkan.
|
||||
* @warning Consult the documentation for MwVulkanField to know what type is expected for out.
|
||||
*/
|
||||
MwInline void* MwVulkanGetField(MwWidget handle, MwVulkanField field, MwErrorEnum* out) {
|
||||
MwInline void* MwVulkanGetField(MwWidget handle, MwVulkanField field, int* out) {
|
||||
void* field_out;
|
||||
MwVaWidgetExecute(handle, "mwVulkanGetField", &field_out, field, out);
|
||||
return field_out;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ MwVulkanConfig vulkan_config = {
|
|||
vk_res = func; \
|
||||
if(vk_res != VK_SUCCESS) { \
|
||||
char buf[1024]; \
|
||||
MwPrintIntoBuffer(buf, 1024, "Vulkan error (%s:%d): %s\n", __FILE__, __LINE__, string_VkResult(vk_res)); \
|
||||
MwStringPrintIntoBuffer(buf, 1024, "Vulkan error (%s:%d): %s\n", __FILE__, __LINE__, string_VkResult(vk_res)); \
|
||||
MwDispatchError(1, buf); \
|
||||
return 1; \
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ MwVulkanConfig vulkan_config = {
|
|||
vk_res = func; \
|
||||
if(vk_res != VK_SUCCESS) { \
|
||||
char buf[1024]; \
|
||||
MwPrintIntoBuffer(buf, 1024, "Vulkan error (%s:%d): (error %d)\n", __FILE__, __LINE__, vk_res); \
|
||||
MwStringPrintIntoBuffer(buf, 1024, "Vulkan error (%s:%d): (error %d)\n", __FILE__, __LINE__, vk_res); \
|
||||
MwDispatchError(1, buf); \
|
||||
return 1; \
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ MwVulkanConfig vulkan_config = {
|
|||
#define VK_ASSERT(val) \
|
||||
if(!val) { \
|
||||
char buf[1024]; \
|
||||
MwPrintIntoBuffer(buf, 1024, "Vulkan error (%s:%d): Assertion Failed (%s != NULL)\n", __FILE__, __LINE__, #val); \
|
||||
MwStringPrintIntoBuffer(buf, 1024, "Vulkan error (%s:%d): Assertion Failed (%s != NULL)\n", __FILE__, __LINE__, #val); \
|
||||
MwDispatchError(1, buf); \
|
||||
return 1; \
|
||||
}
|
||||
|
|
@ -109,29 +109,26 @@ typedef struct vulkan {
|
|||
int vkLayerCount;
|
||||
} vulkan_t;
|
||||
|
||||
static MwErrorEnum vulkan_instance_setup(MwWidget handle, vulkan_t* o);
|
||||
static MwErrorEnum vulkan_surface_setup(MwWidget handle, vulkan_t* o);
|
||||
static MwErrorEnum vulkan_devices_setup(MwWidget handle, vulkan_t* o);
|
||||
static int vulkan_instance_setup(MwWidget handle, vulkan_t* o);
|
||||
static int vulkan_surface_setup(MwWidget handle, vulkan_t* o);
|
||||
static int vulkan_devices_setup(MwWidget handle, vulkan_t* o);
|
||||
|
||||
static int create(MwWidget handle) {
|
||||
vulkan_t* o = malloc(sizeof(*o));
|
||||
MwErrorEnum err;
|
||||
vulkan_t* o = malloc(sizeof(*o));
|
||||
int err;
|
||||
|
||||
memset(o, 0, sizeof(*o));
|
||||
|
||||
err = vulkan_instance_setup(handle, o);
|
||||
if(err != 0) {
|
||||
printf("%s", MwGetLastError());
|
||||
return 1;
|
||||
}
|
||||
err = vulkan_surface_setup(handle, o);
|
||||
if(err != 0) {
|
||||
printf("%s", MwGetLastError());
|
||||
return 1;
|
||||
}
|
||||
err = vulkan_devices_setup(handle, o);
|
||||
if(err != 0) {
|
||||
printf("%s", MwGetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +140,7 @@ static int create(MwWidget handle) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static MwErrorEnum _destroy(MwWidget handle) {
|
||||
static int _destroy(MwWidget handle) {
|
||||
vulkan_t* o = (vulkan_t*)handle->internal;
|
||||
|
||||
LOAD_VK_FUNCTION(vkDestroyInstance);
|
||||
|
|
@ -164,10 +161,7 @@ static MwErrorEnum _destroy(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void destroy(MwWidget handle) {
|
||||
MwErrorEnum err = _destroy(handle);
|
||||
if(err == 1) {
|
||||
printf("[Vulkan Widget] %s", MwGetLastError());
|
||||
}
|
||||
int err = _destroy(handle);
|
||||
}
|
||||
|
||||
static void* vulkan_lib_load() {
|
||||
|
|
@ -178,7 +172,7 @@ static void* vulkan_lib_load() {
|
|||
#endif
|
||||
}
|
||||
|
||||
static MwErrorEnum vulkan_instance_setup(MwWidget handle, vulkan_t* o) {
|
||||
static int vulkan_instance_setup(MwWidget handle, vulkan_t* o) {
|
||||
uint32_t vulkan_version = vulkan_config.vk_version;
|
||||
uint32_t api_version = vulkan_config.api_version;
|
||||
uint32_t extension_count = 0;
|
||||
|
|
@ -299,7 +293,7 @@ static MwErrorEnum vulkan_instance_setup(MwWidget handle, vulkan_t* o) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static MwErrorEnum vulkan_surface_setup(MwWidget handle, vulkan_t* o) {
|
||||
static int vulkan_surface_setup(MwWidget handle, vulkan_t* o) {
|
||||
int vk_res;
|
||||
#ifdef USE_GDI
|
||||
if(handle->lowlevel->common.type == MwLLBackendGDI) {
|
||||
|
|
@ -348,7 +342,7 @@ static MwErrorEnum vulkan_surface_setup(MwWidget handle, vulkan_t* o) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static MwErrorEnum vulkan_devices_setup(MwWidget handle, vulkan_t* o) {
|
||||
static int vulkan_devices_setup(MwWidget handle, vulkan_t* o) {
|
||||
(void)(handle);
|
||||
|
||||
int vk_res;
|
||||
|
|
@ -497,7 +491,7 @@ VkBool32 MwVulkanSupported(void) {
|
|||
}
|
||||
};
|
||||
|
||||
static void* mwVulkanGetFieldImpl(MwWidget handle, MwVulkanField field, MwErrorEnum* out) {
|
||||
static void* mwVulkanGetFieldImpl(MwWidget handle, MwVulkanField field, int* out) {
|
||||
vulkan_t* o = handle->internal;
|
||||
char buf[1024];
|
||||
|
||||
|
|
@ -536,7 +530,7 @@ static void* mwVulkanGetFieldImpl(MwWidget handle, MwVulkanField field, MwErrorE
|
|||
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
||||
if(strcmp(name, "mwVulkanGetField") == 0) {
|
||||
MwVulkanField field = va_arg(va, MwVulkanField);
|
||||
MwErrorEnum* err = va_arg(va, MwErrorEnum*);
|
||||
int* err = va_arg(va, int*);
|
||||
*(void**)out = mwVulkanGetFieldImpl(handle, field, err);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue