got bored and kinda rewrote GN_DEBUGGER_LAYER_FUNCTIONS
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
gnDeviceFunctions loadVulkanDeviceFunctions() {
|
gnDeviceFunctions loadVulkanDeviceFunctions() {
|
||||||
return (gnDeviceFunctions){
|
return (gnDeviceFunctions){
|
||||||
._gnCreatePresentationQueue = createPresentationQueue,
|
._gnCreatePresentationQueue = createPresentationQueue,
|
||||||
._gnPresentationQueueGetImageAsync = getPresentQueueImageAsync,
|
// ._gnPresentationQueueGetImageAsync = getPresentQueueImageAsync,
|
||||||
._gnDestroyPresentationQueue = destroyPresentationQueue,
|
._gnDestroyPresentationQueue = destroyPresentationQueue,
|
||||||
|
|
||||||
._gnCreateShaderModule = createShaderModule,
|
._gnCreateShaderModule = createShaderModule,
|
||||||
@@ -36,8 +36,8 @@ gnDeviceFunctions loadVulkanDeviceFunctions() {
|
|||||||
._gnCreateCommandPool = createCommandPool,
|
._gnCreateCommandPool = createCommandPool,
|
||||||
._gnDestroyCommandPool = destroyCommandPool,
|
._gnDestroyCommandPool = destroyCommandPool,
|
||||||
|
|
||||||
._gnCreateSemaphore = createSemaphore,
|
// ._gnCreateSemaphore = createSemaphore,
|
||||||
._gnDestroySemaphore = destroySemaphore,
|
// ._gnDestroySemaphore = destroySemaphore,
|
||||||
|
|
||||||
._gnCreateBuffer = createBuffer,
|
._gnCreateBuffer = createBuffer,
|
||||||
._gnBufferData = bufferData,
|
._gnBufferData = bufferData,
|
||||||
@@ -57,10 +57,10 @@ gnDeviceFunctions loadVulkanDeviceFunctions() {
|
|||||||
._gnTextureData = textureData,
|
._gnTextureData = textureData,
|
||||||
._gnDestroyTexture = destroyTexture,
|
._gnDestroyTexture = destroyTexture,
|
||||||
|
|
||||||
._gnCreateFence = createFence,
|
// ._gnCreateFence = createFence,
|
||||||
._gnWaitForFence = waitForFence,
|
// ._gnWaitForFence = waitForFence,
|
||||||
._gnResetFence = resetFence,
|
// ._gnResetFence = resetFence,
|
||||||
._gnDestroyFence = destroyFence,
|
// ._gnDestroyFence = destroyFence,
|
||||||
|
|
||||||
._gnSubmit = submit,
|
._gnSubmit = submit,
|
||||||
._gnPresent = present,
|
._gnPresent = present,
|
||||||
|
@@ -7,8 +7,11 @@ gnReturnCode gnCreatePresentationQueue(gnPresentationQueueHandle* presentationQu
|
|||||||
return device->instance->callingLayer->deviceFunctions._gnCreatePresentationQueue(*presentationQueue, device, presentationInfo);
|
return device->instance->callingLayer->deviceFunctions._gnCreatePresentationQueue(*presentationQueue, device, presentationInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode gnPresentationQueueGetImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex) {
|
// gnReturnCode gnPresentationQueueGetImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex) {
|
||||||
return presentationQueue->outputDevice->instance->callingLayer->deviceFunctions._gnPresentationQueueGetImageAsync(presentationQueue, timeout, semaphore, imageIndex);
|
// return presentationQueue->outputDevice->instance->callingLayer->deviceFunctions._gnPresentationQueueGetImageAsync(presentationQueue, timeout, semaphore, imageIndex);
|
||||||
|
// }
|
||||||
|
gnReturnCode gnPresentationQueueGetImage(gnPresentationQueueHandle presentationQueue, uint32_t* imageIndex) {
|
||||||
|
return presentationQueue->outputDevice->instance->callingLayer->deviceFunctions._gnPresentationQueueGetImage(presentationQueue, imageIndex);
|
||||||
}
|
}
|
||||||
uint32_t gnGetPresentationQueueImageCount(gnPresentationQueueHandle presentationQueue) { return presentationQueue->imageCount; }
|
uint32_t gnGetPresentationQueueImageCount(gnPresentationQueueHandle presentationQueue) { return presentationQueue->imageCount; }
|
||||||
gnTextureHandle gnGetPresentationQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t index) {
|
gnTextureHandle gnGetPresentationQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t index) {
|
||||||
|
@@ -28,7 +28,7 @@ struct gnPresentationQueue_t {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
gnReturnCode gnCreatePresentationQueue(gnPresentationQueueHandle* presentationQueue, gnOutputDeviceHandle device, gnPresentationQueueInfo presentationInfo);
|
gnReturnCode gnCreatePresentationQueue(gnPresentationQueueHandle* presentationQueue, gnOutputDeviceHandle device, gnPresentationQueueInfo presentationInfo);
|
||||||
gnReturnCode gnPresentationQueueGetImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex);
|
// gnReturnCode gnPresentationQueueGetImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex);
|
||||||
gnReturnCode gnPresentationQueueGetImage(gnPresentationQueue presentationQueue, uint32_t* imageIndex);
|
gnReturnCode gnPresentationQueueGetImage(gnPresentationQueue presentationQueue, uint32_t* imageIndex);
|
||||||
uint32_t gnGetPresentationQueueImageCount(gnPresentationQueueHandle presentationQueue);
|
uint32_t gnGetPresentationQueueImageCount(gnPresentationQueueHandle presentationQueue);
|
||||||
gnTextureHandle gnGetPresentationQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t index);
|
gnTextureHandle gnGetPresentationQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t index);
|
||||||
|
@@ -8,21 +8,21 @@ gnReturnCode gnCreateFence(gnFenceHandle* fence, gnDevice device) {
|
|||||||
*fence = malloc(sizeof(struct gnFence_t));
|
*fence = malloc(sizeof(struct gnFence_t));
|
||||||
(*fence)->device = device;
|
(*fence)->device = device;
|
||||||
(*fence)->signaled = gnFalse;
|
(*fence)->signaled = gnFalse;
|
||||||
return device->instance->callingLayer->deviceFunctions._gnCreateFence(*fence, device);
|
return device->instance->callingLayer->syncFunctions._gnCreateFence(*fence, device);
|
||||||
}
|
}
|
||||||
void gnSignalFence(gnFenceHandle fence) {
|
void gnSignalFence(gnFenceHandle fence) {
|
||||||
fence->signaled = gnTrue;
|
fence->signaled = gnTrue;
|
||||||
}
|
}
|
||||||
void gnWaitForFence(gnFenceHandle fence, uint64_t timeout) {
|
void gnWaitForFence(gnFenceHandle fence, uint64_t timeout) {
|
||||||
if (fence->signaled == gnTrue) return;
|
if (fence->signaled == gnTrue) return;
|
||||||
fence->device->instance->callingLayer->deviceFunctions._gnWaitForFence(fence, timeout);
|
fence->device->instance->callingLayer->syncFunctions._gnWaitForFence(fence, timeout);
|
||||||
}
|
}
|
||||||
void gnResetFence(gnFenceHandle fence) {
|
void gnResetFence(gnFenceHandle fence) {
|
||||||
fence->signaled = gnFalse;
|
fence->signaled = gnFalse;
|
||||||
fence->device->instance->callingLayer->deviceFunctions._gnResetFence(fence);
|
fence->device->instance->callingLayer->syncFunctions._gnResetFence(fence);
|
||||||
}
|
}
|
||||||
void gnDestroyFence(gnFenceHandle fence) {
|
void gnDestroyFence(gnFenceHandle fence) {
|
||||||
fence->device->instance->callingLayer->deviceFunctions._gnDestroyFence(fence);
|
fence->device->instance->callingLayer->syncFunctions._gnDestroyFence(fence);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
|
17
projects/extensions/synchronization/loader/sync_functions.h
Normal file
17
projects/extensions/synchronization/loader/sync_functions.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "stdint.h"
|
||||||
|
#include "utils/gryphn_error_code.h"
|
||||||
|
#include "core/src/gryphn_handles.h"
|
||||||
|
|
||||||
|
typedef struct gnSyncExtFunctions {
|
||||||
|
gnReturnCode (*_gnPresentationQueueGetImageAsync)(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex);
|
||||||
|
|
||||||
|
gnReturnCode (*_gnCreateSemaphore)(gnSemaphoreHandle semaphore, gnOutputDeviceHandle device);
|
||||||
|
void (*_gnDestroySemaphore)(gnSemaphoreHandle semaphore);
|
||||||
|
|
||||||
|
|
||||||
|
gnReturnCode (*_gnCreateFence)(gnFenceHandle fence, gnOutputDeviceHandle device);
|
||||||
|
void (*_gnWaitForFence)(gnFenceHandle fence, uint64_t timeout);
|
||||||
|
void (*_gnResetFence)(gnFenceHandle fence);
|
||||||
|
void (*_gnDestroyFence)(gnFenceHandle fence);
|
||||||
|
} gnSyncExtFunctions;
|
@@ -7,10 +7,10 @@
|
|||||||
gnReturnCode gnCreateSemaphore(gnSemaphore* semaphore, struct gnOutputDevice_t* device) {
|
gnReturnCode gnCreateSemaphore(gnSemaphore* semaphore, struct gnOutputDevice_t* device) {
|
||||||
*semaphore = malloc(sizeof(struct gnSemaphore_t));
|
*semaphore = malloc(sizeof(struct gnSemaphore_t));
|
||||||
(*semaphore)->device = device;
|
(*semaphore)->device = device;
|
||||||
return device->instance->callingLayer->deviceFunctions._gnCreateSemaphore((*semaphore), device);
|
return device->instance->callingLayer->syncFunctions._gnCreateSemaphore((*semaphore), device);
|
||||||
}
|
}
|
||||||
void gnDestroySemaphore(struct gnSemaphore_t* semaphore) {
|
void gnDestroySemaphore(struct gnSemaphore_t* semaphore) {
|
||||||
semaphore->device->instance->callingLayer->deviceFunctions._gnDestroySemaphore(semaphore);
|
semaphore->device->instance->callingLayer->syncFunctions._gnDestroySemaphore(semaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
|
@@ -20,9 +20,7 @@ typedef struct gnSubmitInfo gnSubmitInfo;
|
|||||||
typedef struct gnPresentInfo gnPresentInfo;
|
typedef struct gnPresentInfo gnPresentInfo;
|
||||||
|
|
||||||
typedef struct gnDeviceFunctions {
|
typedef struct gnDeviceFunctions {
|
||||||
gnReturnCode (*_gnCreatePresentationQueue)(gnPresentationQueueHandle presentationQueue, const gnOutputDeviceHandle device, gnPresentationQueueInfo presentationInfo);
|
gnReturnCode (*_gnCreatePresentationQueue)(gnPresentationQueueHandle presentationQueue, const gnOutputDeviceHandle device, gnPresentationQueueInfo presentationInfo); gnReturnCode (*_gnPresentationQueueGetImage)(gnPresentationQueueHandle presentationQueue, uint32_t* imageIndex);
|
||||||
gnReturnCode (*_gnPresentationQueueGetImageAsync)(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex);
|
|
||||||
gnReturnCode (*_gnPresentationQueueGetImage)(gnPresentationQueueHandle presentationQueue, uint32_t* imageIndex);
|
|
||||||
void (*_gnDestroyPresentationQueue)(gnPresentationQueueHandle presentationQueue);
|
void (*_gnDestroyPresentationQueue)(gnPresentationQueueHandle presentationQueue);
|
||||||
|
|
||||||
gnReturnCode (*_gnCreateShaderModule)(gnShaderModuleHandle module, gnOutputDeviceHandle device, gnShaderModuleInfo shaderModuleInfo);
|
gnReturnCode (*_gnCreateShaderModule)(gnShaderModuleHandle module, gnOutputDeviceHandle device, gnShaderModuleInfo shaderModuleInfo);
|
||||||
@@ -40,9 +38,6 @@ typedef struct gnDeviceFunctions {
|
|||||||
gnReturnCode (*_gnCreateCommandPool)(gnCommandPoolHandle commandPool, gnOutputDeviceHandle device, gnCommandPoolInfo info);
|
gnReturnCode (*_gnCreateCommandPool)(gnCommandPoolHandle commandPool, gnOutputDeviceHandle device, gnCommandPoolInfo info);
|
||||||
void (*_gnDestroyCommandPool)(gnCommandPoolHandle commandPool);
|
void (*_gnDestroyCommandPool)(gnCommandPoolHandle commandPool);
|
||||||
|
|
||||||
gnReturnCode (*_gnCreateSemaphore)(gnSemaphoreHandle semaphore, gnOutputDeviceHandle device);
|
|
||||||
void (*_gnDestroySemaphore)(gnSemaphoreHandle semaphore);
|
|
||||||
|
|
||||||
gnReturnCode (*_gnCreateBuffer)(gnBufferHandle buffer, gnDeviceHandle device, gnBufferInfo info);
|
gnReturnCode (*_gnCreateBuffer)(gnBufferHandle buffer, gnDeviceHandle device, gnBufferInfo info);
|
||||||
void (*_gnBufferData)(gnBufferHandle buffer, size_t size, void* data);
|
void (*_gnBufferData)(gnBufferHandle buffer, size_t size, void* data);
|
||||||
void (*_gnBufferSubData)(gnBufferHandle buffer, size_t offset, size_t dataSize, void* data);
|
void (*_gnBufferSubData)(gnBufferHandle buffer, size_t offset, size_t dataSize, void* data);
|
||||||
@@ -61,11 +56,6 @@ typedef struct gnDeviceFunctions {
|
|||||||
void (*_gnTextureData)(gnTextureHandle texture, void* pixelData);
|
void (*_gnTextureData)(gnTextureHandle texture, void* pixelData);
|
||||||
void (*_gnDestroyTexture)(gnTexture texture);
|
void (*_gnDestroyTexture)(gnTexture texture);
|
||||||
|
|
||||||
gnReturnCode (*_gnCreateFence)(gnFenceHandle fence, gnOutputDeviceHandle device);
|
|
||||||
void (*_gnWaitForFence)(gnFenceHandle fence, uint64_t timeout);
|
|
||||||
void (*_gnResetFence)(gnFenceHandle fence);
|
|
||||||
void (*_gnDestroyFence)(gnFenceHandle fence);
|
|
||||||
|
|
||||||
gnReturnCode (*_gnSubmit)(gnOutputDeviceHandle device, gnSubmitInfo submit);
|
gnReturnCode (*_gnSubmit)(gnOutputDeviceHandle device, gnSubmitInfo submit);
|
||||||
gnReturnCode (*_gnPresent)(gnOutputDeviceHandle device, gnPresentInfo info);
|
gnReturnCode (*_gnPresent)(gnOutputDeviceHandle device, gnPresentInfo info);
|
||||||
|
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
#include "gryphn_loader_info.h"
|
#include "gryphn_loader_info.h"
|
||||||
#include "utils/lists/gryphn_array_list.h"
|
#include "utils/lists/gryphn_array_list.h"
|
||||||
|
|
||||||
|
#include "extensions/synchronization/loader/sync_functions.h"
|
||||||
|
|
||||||
typedef struct loaderLayer {
|
typedef struct loaderLayer {
|
||||||
// idk why I sperate these info different classes, I should really shove them in one bit class
|
// idk why I sperate these info different classes, I should really shove them in one bit class
|
||||||
// they used to be loaded seperatly but I guess there not anymore
|
// they used to be loaded seperatly but I guess there not anymore
|
||||||
@@ -13,6 +15,8 @@ typedef struct loaderLayer {
|
|||||||
gnDeviceFunctions deviceFunctions;
|
gnDeviceFunctions deviceFunctions;
|
||||||
gnCommandFunctions commandFunctions;
|
gnCommandFunctions commandFunctions;
|
||||||
|
|
||||||
|
gnSyncExtFunctions syncFunctions;
|
||||||
|
|
||||||
// this index is not set by loadLayer, set by gnCreateInstance, also not used for now
|
// this index is not set by loadLayer, set by gnCreateInstance, also not used for now
|
||||||
uint32_t layerIndex;
|
uint32_t layerIndex;
|
||||||
} loaderLayer;
|
} loaderLayer;
|
||||||
|
@@ -40,7 +40,7 @@ gnInstanceFunctions loadFunctionLoaderInstanceFunctions() {
|
|||||||
gnDeviceFunctions loadFunctionLoaderDeviceFunctions() {
|
gnDeviceFunctions loadFunctionLoaderDeviceFunctions() {
|
||||||
return (gnDeviceFunctions){
|
return (gnDeviceFunctions){
|
||||||
._gnCreatePresentationQueue = checkCreatePresentationQueue,
|
._gnCreatePresentationQueue = checkCreatePresentationQueue,
|
||||||
._gnPresentationQueueGetImageAsync = checkPresentationQueueGetImageAsync,
|
// ._gnPresentationQueueGetImageAsync = checkPresentationQueueGetImageAsync,
|
||||||
._gnPresentationQueueGetImage = checkPresentationQueueGetImage,
|
._gnPresentationQueueGetImage = checkPresentationQueueGetImage,
|
||||||
._gnDestroyPresentationQueue = checkDestroyPresentationQueue,
|
._gnDestroyPresentationQueue = checkDestroyPresentationQueue,
|
||||||
|
|
||||||
@@ -59,8 +59,8 @@ gnDeviceFunctions loadFunctionLoaderDeviceFunctions() {
|
|||||||
._gnCreateCommandPool = checkCreateCommandPool,
|
._gnCreateCommandPool = checkCreateCommandPool,
|
||||||
._gnDestroyCommandPool = checkDestroyCommandPool,
|
._gnDestroyCommandPool = checkDestroyCommandPool,
|
||||||
|
|
||||||
._gnCreateSemaphore = checkCreateSemaphore,
|
// ._gnCreateSemaphore = checkCreateSemaphore,
|
||||||
._gnDestroySemaphore = checkDestroySemaphore,
|
// ._gnDestroySemaphore = checkDestroySemaphore,
|
||||||
|
|
||||||
._gnCreateBuffer = checkCreateBuffer,
|
._gnCreateBuffer = checkCreateBuffer,
|
||||||
._gnBufferData = checkBufferData,
|
._gnBufferData = checkBufferData,
|
||||||
@@ -80,10 +80,10 @@ gnDeviceFunctions loadFunctionLoaderDeviceFunctions() {
|
|||||||
._gnTextureData = checkTextureData,
|
._gnTextureData = checkTextureData,
|
||||||
._gnDestroyTexture = checkDestroyTexture,
|
._gnDestroyTexture = checkDestroyTexture,
|
||||||
|
|
||||||
._gnCreateFence = checkCreateFence,
|
// ._gnCreateFence = checkCreateFence,
|
||||||
._gnWaitForFence = checkWaitForFence,
|
// ._gnWaitForFence = checkWaitForFence,
|
||||||
._gnResetFence = checkResetFence,
|
// ._gnResetFence = checkResetFence,
|
||||||
._gnDestroyFence = checkDestroyFence,
|
// ._gnDestroyFence = checkDestroyFence,
|
||||||
|
|
||||||
._gnSubmit = checkSubmit,
|
._gnSubmit = checkSubmit,
|
||||||
._gnPresent = checkPresent,
|
._gnPresent = checkPresent,
|
||||||
|
32
projects/validation_layers/function_loader/loader_utils.h
Normal file
32
projects/validation_layers/function_loader/loader_utils.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
#define CHECK_FUNCTION_WITH_RETURN_CODE(instance, function, type, ...) \
|
||||||
|
loaderLayer* nextLayer = loaderGetNextLayer(instance); \
|
||||||
|
if (nextLayer->type.function == NULL) { \
|
||||||
|
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){ \
|
||||||
|
.message = gnCreateString("Failed to load " #function " this indicates a bug within gryphn") \
|
||||||
|
}); \
|
||||||
|
resetLayer(instance); \
|
||||||
|
return GN_FAILED_TO_LOAD_FUNCTION; \
|
||||||
|
} \
|
||||||
|
return nextLayer->type.function(__VA_ARGS__);
|
||||||
|
|
||||||
|
#define CHECK_RETURNED_FUNCTION(instance, function, type, fail_return, ...) \
|
||||||
|
loaderLayer* nextLayer = loaderGetNextLayer(instance); \
|
||||||
|
if (nextLayer->type.function == NULL) { \
|
||||||
|
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){ \
|
||||||
|
.message = gnCreateString("Failed to load " #function " this indicates a bug within gryphn") \
|
||||||
|
}); \
|
||||||
|
resetLayer(instance); \
|
||||||
|
return fail_return; \
|
||||||
|
} \
|
||||||
|
return nextLayer->type.function(__VA_ARGS__);
|
||||||
|
|
||||||
|
#define CHECK_VOID_FUNCTION(instance, function, type, ...) \
|
||||||
|
loaderLayer* nextLayer = loaderGetNextLayer(instance); \
|
||||||
|
if (nextLayer->type.function == NULL) { \
|
||||||
|
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){ \
|
||||||
|
.message = gnCreateString("Failed to load " #function " this indicates a bug within gryphn") \
|
||||||
|
}); \
|
||||||
|
resetLayer(instance); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
nextLayer->type.function(__VA_ARGS__);
|
@@ -10,50 +10,50 @@
|
|||||||
#include "loader_utils.h"
|
#include "loader_utils.h"
|
||||||
|
|
||||||
gnReturnCode checkCommandPoolAllocateCommandBuffers(gnCommandBufferHandle* commandBuffers, uint32_t count, gnCommandPoolHandle pool) {
|
gnReturnCode checkCommandPoolAllocateCommandBuffers(gnCommandBufferHandle* commandBuffers, uint32_t count, gnCommandPoolHandle pool) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE_COMMAND(pool->device->instance, _gnCommandPoolAllocateCommandBuffers, commandBuffers, count, pool);
|
CHECK_FUNCTION_WITH_RETURN_CODE(pool->device->instance, _gnCommandPoolAllocateCommandBuffers, commandFunctions, commandBuffers, count, pool);
|
||||||
}
|
}
|
||||||
gnReturnCode checkBeginCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
gnReturnCode checkBeginCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE_COMMAND(commandBuffer->instance, _gnBeginCommandBuffer, commandBuffer);
|
CHECK_FUNCTION_WITH_RETURN_CODE(commandBuffer->instance, _gnBeginCommandBuffer, commandFunctions, commandBuffer);
|
||||||
}
|
}
|
||||||
void checkResetCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
void checkResetCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||||
CHECK_VOID_FUNCTION_COMMAND(commandBuffer->instance, _gnResetCommandBuffer, commandBuffer);
|
CHECK_VOID_FUNCTION(commandBuffer->instance, _gnResetCommandBuffer, commandFunctions, commandBuffer);
|
||||||
}
|
}
|
||||||
gnReturnCode checkEndCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
gnReturnCode checkEndCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE_COMMAND(commandBuffer->instance, _gnEndCommandBuffer, commandBuffer);
|
CHECK_FUNCTION_WITH_RETURN_CODE(commandBuffer->instance, _gnEndCommandBuffer, commandFunctions, commandBuffer);
|
||||||
}
|
}
|
||||||
void checkDestroyCommandBuffer(gnCommandBufferHandle buffer) {
|
void checkDestroyCommandBuffer(gnCommandBufferHandle buffer) {
|
||||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnDestroyCommandBuffer, buffer);
|
CHECK_VOID_FUNCTION(buffer->instance, _gnDestroyCommandBuffer, commandFunctions, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkCommandBeginRenderPass(gnCommandBufferHandle buffer, gnRenderPassInfo passInfo) {
|
void checkCommandBeginRenderPass(gnCommandBufferHandle buffer, gnRenderPassInfo passInfo) {
|
||||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandBeginRenderPass, buffer, passInfo);
|
CHECK_VOID_FUNCTION(buffer->instance, _gnCommandBeginRenderPass, commandFunctions, buffer, passInfo);
|
||||||
}
|
}
|
||||||
void checkCommandEndRenderPass(gnCommandBufferHandle buffer) {
|
void checkCommandEndRenderPass(gnCommandBufferHandle buffer) {
|
||||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandEndRenderPass, buffer);
|
CHECK_VOID_FUNCTION(buffer->instance, _gnCommandEndRenderPass, commandFunctions, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkCommandBindGraphicsPipeline(gnCommandBufferHandle buffer, gnGraphicsPipelineHandle graphicsPipeline) {
|
void checkCommandBindGraphicsPipeline(gnCommandBufferHandle buffer, gnGraphicsPipelineHandle graphicsPipeline) {
|
||||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandBindGraphicsPipeline, buffer, graphicsPipeline);
|
CHECK_VOID_FUNCTION(buffer->instance, _gnCommandBindGraphicsPipeline, commandFunctions, buffer, graphicsPipeline);
|
||||||
}
|
}
|
||||||
void checkCommandSetViewport(gnCommandBufferHandle buffer, gnViewport viewport) {
|
void checkCommandSetViewport(gnCommandBufferHandle buffer, gnViewport viewport) {
|
||||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandSetViewport, buffer, viewport);
|
CHECK_VOID_FUNCTION(buffer->instance, _gnCommandSetViewport, commandFunctions, buffer, viewport);
|
||||||
}
|
}
|
||||||
void checkCommandSetScissor(gnCommandBufferHandle buffer, gnScissor scissor) {
|
void checkCommandSetScissor(gnCommandBufferHandle buffer, gnScissor scissor) {
|
||||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandSetScissor, buffer, scissor);
|
CHECK_VOID_FUNCTION(buffer->instance, _gnCommandSetScissor, commandFunctions, buffer, scissor);
|
||||||
}
|
}
|
||||||
void checkCommandBindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set) {
|
void checkCommandBindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set) {
|
||||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandBindUniform, buffer, uniform, set);
|
CHECK_VOID_FUNCTION(buffer->instance, _gnCommandBindUniform, commandFunctions, buffer, uniform, set);
|
||||||
}
|
}
|
||||||
void checkCommandPushConstant(gnCommandBufferHandle buffer, gnPushConstantLayout layout, void* data) {
|
void checkCommandPushConstant(gnCommandBufferHandle buffer, gnPushConstantLayout layout, void* data) {
|
||||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandPushConstant, buffer, layout, data);
|
CHECK_VOID_FUNCTION(buffer->instance, _gnCommandPushConstant, commandFunctions, buffer, layout, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkCommandBindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type) {
|
void checkCommandBindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type) {
|
||||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandBindBuffer, buffer, bufferToBind, type);
|
CHECK_VOID_FUNCTION(buffer->instance, _gnCommandBindBuffer, commandFunctions, buffer, bufferToBind, type);
|
||||||
}
|
}
|
||||||
void checkCommandDraw(gnCommandBufferHandle buffer, int vertexCount, int firstVertex, int instanceCount, int firstInstance) {
|
void checkCommandDraw(gnCommandBufferHandle buffer, int vertexCount, int firstVertex, int instanceCount, int firstInstance) {
|
||||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandDraw, buffer, vertexCount, firstVertex, instanceCount, firstInstance);
|
CHECK_VOID_FUNCTION(buffer->instance, _gnCommandDraw, commandFunctions, buffer, vertexCount, firstVertex, instanceCount, firstInstance);
|
||||||
}
|
}
|
||||||
void checkCommandDrawIndexed(gnCommandBufferHandle buffer, gnIndexType type, int indexCount, int firstIndex, int vertexOffset, int instanceCount, int firstInstance) {
|
void checkCommandDrawIndexed(gnCommandBufferHandle buffer, gnIndexType type, int indexCount, int firstIndex, int vertexOffset, int instanceCount, int firstInstance) {
|
||||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandDrawIndexed, buffer, type, indexCount, firstIndex, vertexOffset, instanceCount, firstInstance);
|
CHECK_VOID_FUNCTION(buffer->instance, _gnCommandDrawIndexed, commandFunctions, buffer, type, indexCount, firstIndex, vertexOffset, instanceCount, firstInstance);
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#include "device_functions.h"
|
#include "device_functions.h"
|
||||||
#include "loader_utils.h"
|
#include "loader_utils.h"
|
||||||
#include "core/src/debugger/gryphn_debugger.h"
|
#include <core/src/debugger/gryphn_debugger.h>
|
||||||
#include "core/src/presentation_queue/gryphn_presentation_queue.h"
|
#include "core/src/presentation_queue/gryphn_presentation_queue.h"
|
||||||
#include "core/src/shader_module/gryphn_shader_module.h"
|
#include "core/src/shader_module/gryphn_shader_module.h"
|
||||||
#include "core/src/renderpass/gryphn_render_pass_descriptor.h"
|
#include "core/src/renderpass/gryphn_render_pass_descriptor.h"
|
||||||
@@ -10,178 +10,130 @@
|
|||||||
#include "core/src/buffers/gryphn_buffer.h"
|
#include "core/src/buffers/gryphn_buffer.h"
|
||||||
#include "core/src/uniforms/gryphn_uniform_pool.h"
|
#include "core/src/uniforms/gryphn_uniform_pool.h"
|
||||||
#include "core/src/textures/gryphn_texture.h"
|
#include "core/src/textures/gryphn_texture.h"
|
||||||
#include "synchronization/fence/gryphn_fence.h"
|
|
||||||
#include "synchronization/semaphore/gryphn_semaphore.h"
|
|
||||||
#include "core/src/submit/gryphn_submit.h"
|
#include "core/src/submit/gryphn_submit.h"
|
||||||
#include "core/src/present/gryphn_present.h"
|
#include "core/src/present/gryphn_present.h"
|
||||||
|
|
||||||
gnReturnCode checkCreatePresentationQueue(gnPresentationQueueHandle presentationQueue, const gnOutputDeviceHandle device, gnPresentationQueueInfo presentationInfo){
|
gnReturnCode checkCreatePresentationQueue(gnPresentationQueueHandle presentationQueue, const gnOutputDeviceHandle device, gnPresentationQueueInfo presentationInfo){
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(presentationQueue->outputDevice->instance);
|
CHECK_FUNCTION_WITH_RETURN_CODE(presentationQueue->outputDevice->instance, _gnCreatePresentationQueue, deviceFunctions, presentationQueue, device, presentationInfo);
|
||||||
if (nextLayer->deviceFunctions._gnCreatePresentationQueue == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(presentationQueue->outputDevice->instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load create presentation queue function")
|
|
||||||
});
|
|
||||||
resetLayer(presentationQueue->outputDevice->instance);
|
|
||||||
return GN_FAILED_TO_LOAD_FUNCTION;
|
|
||||||
}
|
|
||||||
return nextLayer->deviceFunctions._gnCreatePresentationQueue(presentationQueue, device, presentationInfo);
|
|
||||||
}
|
|
||||||
gnReturnCode checkPresentationQueueGetImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex) {
|
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(presentationQueue->outputDevice->instance, _gnPresentationQueueGetImageAsync, presentationQueue, timeout, semaphore, imageIndex);
|
|
||||||
}
|
}
|
||||||
|
// gnReturnCode checkPresentationQueueGetImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex) {
|
||||||
|
// CHECK_FUNCTION_WITH_RETURN_CODE(presentationQueue->outputDevice->instance, _gnPresentationQueueGetImageAsync, presentationQueue, timeout, semaphore, imageIndex);
|
||||||
|
// }
|
||||||
gnReturnCode checkPresentationQueueGetImage(gnPresentationQueueHandle presentationQueue, uint32_t *imageIndex) {
|
gnReturnCode checkPresentationQueueGetImage(gnPresentationQueueHandle presentationQueue, uint32_t *imageIndex) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(presentationQueue->outputDevice->instance, _gnPresentationQueueGetImage, presentationQueue, imageIndex);
|
CHECK_FUNCTION_WITH_RETURN_CODE(presentationQueue->outputDevice->instance, _gnPresentationQueueGetImage, deviceFunctions, presentationQueue, imageIndex);
|
||||||
}
|
}
|
||||||
void checkDestroyPresentationQueue(gnPresentationQueueHandle presentationQueue) {
|
void checkDestroyPresentationQueue(gnPresentationQueueHandle presentationQueue) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(presentationQueue->outputDevice->instance);
|
CHECK_VOID_FUNCTION(presentationQueue->outputDevice->instance, _gnDestroyPresentationQueue, deviceFunctions, presentationQueue);
|
||||||
if (nextLayer->deviceFunctions._gnDestroyPresentationQueue == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(presentationQueue->outputDevice->instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load destroy presentation queue function")
|
|
||||||
});
|
|
||||||
resetLayer(presentationQueue->outputDevice->instance);
|
|
||||||
}
|
|
||||||
nextLayer->deviceFunctions._gnDestroyPresentationQueue(presentationQueue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode checkCreateShaderModule(gnShaderModuleHandle module, gnOutputDeviceHandle device, gnShaderModuleInfo shaderModuleInfo) {
|
gnReturnCode checkCreateShaderModule(gnShaderModuleHandle module, gnOutputDeviceHandle device, gnShaderModuleInfo shaderModuleInfo) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(device->instance);
|
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateShaderModule, deviceFunctions, module, device, shaderModuleInfo);
|
||||||
if (nextLayer->deviceFunctions._gnCreateShaderModule == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(device->instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load create shader module function")
|
|
||||||
});
|
|
||||||
resetLayer(device->instance);
|
|
||||||
return GN_FAILED_TO_LOAD_FUNCTION;
|
|
||||||
}
|
|
||||||
return nextLayer->deviceFunctions._gnCreateShaderModule(module, device, shaderModuleInfo);
|
|
||||||
}
|
}
|
||||||
void checkDestroyShaderModule(gnShaderModuleHandle module){
|
void checkDestroyShaderModule(gnShaderModuleHandle module) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(module->device->instance);
|
CHECK_VOID_FUNCTION(module->device->instance, _gnDestroyShaderModule, deviceFunctions, module);
|
||||||
if (nextLayer->deviceFunctions._gnDestroyShaderModule == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(module->device->instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load destroy shader module function")
|
|
||||||
});
|
|
||||||
resetLayer(module->device->instance);
|
|
||||||
}
|
|
||||||
nextLayer->deviceFunctions._gnDestroyShaderModule(module);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode checkCreateRenderPassDescriptor(gnRenderPassDescriptorHandle renderPass, gnOutputDeviceHandle device, gnRenderPassDescriptorInfo info) {
|
gnReturnCode checkCreateRenderPassDescriptor(gnRenderPassDescriptorHandle renderPass, gnOutputDeviceHandle device, gnRenderPassDescriptorInfo info) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateRenderPassDescriptor, renderPass, device, info);
|
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateRenderPassDescriptor, deviceFunctions, renderPass, device, info);
|
||||||
}
|
}
|
||||||
void checkDestroyRenderPassDescriptor(gnRenderPassDescriptorHandle renderPass) {
|
void checkDestroyRenderPassDescriptor(gnRenderPassDescriptorHandle renderPass) {
|
||||||
CHECK_VOID_FUNCTION(renderPass->device->instance, _gnDestroyRenderPassDescriptor, renderPass);
|
CHECK_VOID_FUNCTION(renderPass->device->instance, _gnDestroyRenderPassDescriptor, deviceFunctions, renderPass);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode checkCreateGraphicsPipeline(gnGraphicsPipelineHandle pipeline, gnOutputDeviceHandle device, gnGraphicsPipelineInfo info) {
|
gnReturnCode checkCreateGraphicsPipeline(gnGraphicsPipelineHandle pipeline, gnOutputDeviceHandle device, gnGraphicsPipelineInfo info) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateGraphicsPipeline, pipeline, device, info);
|
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateGraphicsPipeline, deviceFunctions, pipeline, device, info);
|
||||||
}
|
}
|
||||||
void checkDestroyGraphicsPipeline(gnGraphicsPipelineHandle pipeline) {
|
void checkDestroyGraphicsPipeline(gnGraphicsPipelineHandle pipeline) {
|
||||||
CHECK_VOID_FUNCTION(pipeline->device->instance, _gnDestroyGraphicsPipeline, pipeline);
|
CHECK_VOID_FUNCTION(pipeline->device->instance, _gnDestroyGraphicsPipeline, deviceFunctions, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode checkCreateFramebuffer(gnFramebuffer framebuffer, gnOutputDeviceHandle device, gnFramebufferInfo framebufferInfo) {
|
gnReturnCode checkCreateFramebuffer(gnFramebuffer framebuffer, gnOutputDeviceHandle device, gnFramebufferInfo framebufferInfo) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateFramebuffer, framebuffer, device, framebufferInfo);
|
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateFramebuffer, deviceFunctions, framebuffer, device, framebufferInfo);
|
||||||
}
|
}
|
||||||
void checkDestroyFramebuffer(gnFramebuffer framebuffer) {
|
void checkDestroyFramebuffer(gnFramebuffer framebuffer) {
|
||||||
CHECK_VOID_FUNCTION(framebuffer->device->instance, _gnDestroyFramebuffer, framebuffer);
|
CHECK_VOID_FUNCTION(framebuffer->device->instance, _gnDestroyFramebuffer, deviceFunctions, framebuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode checkCreateCommandPool(gnCommandPoolHandle commandPool, gnOutputDeviceHandle device, gnCommandPoolInfo info) {
|
gnReturnCode checkCreateCommandPool(gnCommandPoolHandle commandPool, gnOutputDeviceHandle device, gnCommandPoolInfo info) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateCommandPool, commandPool, device, info);
|
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateCommandPool, deviceFunctions, commandPool, device, info);
|
||||||
}
|
}
|
||||||
void checkDestroyCommandPool(gnCommandPoolHandle commandPool) {
|
void checkDestroyCommandPool(gnCommandPoolHandle commandPool) {
|
||||||
CHECK_VOID_FUNCTION(commandPool->device->instance, _gnDestroyCommandPool, commandPool);
|
CHECK_VOID_FUNCTION(commandPool->device->instance, _gnDestroyCommandPool, deviceFunctions, commandPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode checkCreateSemaphore(gnSemaphoreHandle semaphore, gnOutputDeviceHandle device) {
|
// gnReturnCode checkCreateSemaphore(gnSemaphoreHandle semaphore, gnOutputDeviceHandle device) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateSemaphore, semaphore, device);
|
// CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateSemaphore, semaphore, device);
|
||||||
}
|
// }
|
||||||
void checkDestroySemaphore(gnSemaphoreHandle semaphore) {
|
// void checkDestroySemaphore(gnSemaphoreHandle semaphore) {
|
||||||
CHECK_VOID_FUNCTION(semaphore->device->instance, _gnDestroySemaphore, semaphore);
|
// CHECK_VOID_FUNCTION(semaphore->device->instance, _gnDestroySemaphore, semaphore);
|
||||||
}
|
// }
|
||||||
|
|
||||||
gnReturnCode checkCreateBuffer(gnBufferHandle buffer, gnDeviceHandle device, gnBufferInfo info) {
|
gnReturnCode checkCreateBuffer(gnBufferHandle buffer, gnDeviceHandle device, gnBufferInfo info) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateBuffer, buffer, device, info);
|
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateBuffer, deviceFunctions, buffer, device, info);
|
||||||
}
|
}
|
||||||
void checkBufferData(gnBufferHandle buffer, size_t size, void* data) {
|
void checkBufferData(gnBufferHandle buffer, size_t size, void* data) {
|
||||||
CHECK_VOID_FUNCTION(buffer->device->instance, _gnBufferData, buffer, size, data);
|
CHECK_VOID_FUNCTION(buffer->device->instance, _gnBufferData, deviceFunctions, buffer, size, data);
|
||||||
}
|
}
|
||||||
void checkBufferSubData(gnBufferHandle buffer, size_t offset, size_t size, void* data) {
|
void checkBufferSubData(gnBufferHandle buffer, size_t offset, size_t size, void* data) {
|
||||||
CHECK_VOID_FUNCTION(buffer->device->instance, _gnBufferSubData, buffer, offset, size, data);
|
CHECK_VOID_FUNCTION(buffer->device->instance, _gnBufferSubData, deviceFunctions, buffer, offset, size, data);
|
||||||
}
|
}
|
||||||
void* checkMapBuffer(gnBufferHandle buffer) {
|
void* checkMapBuffer(gnBufferHandle buffer) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(buffer->device->instance);
|
CHECK_RETURNED_FUNCTION(buffer->device->instance, _gnMapBuffer, deviceFunctions, NULL, buffer);
|
||||||
if (nextLayer->deviceFunctions._gnMapBuffer == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(buffer->device->instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load create map buffer function")
|
|
||||||
});
|
|
||||||
resetLayer(buffer->device->instance);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return nextLayer->deviceFunctions._gnMapBuffer(buffer);
|
|
||||||
}
|
}
|
||||||
void checkDestroyBuffer(gnBufferHandle buffer) {
|
void checkDestroyBuffer(gnBufferHandle buffer) {
|
||||||
CHECK_VOID_FUNCTION(buffer->device->instance, _gnDestroyBuffer, buffer);
|
CHECK_VOID_FUNCTION(buffer->device->instance, _gnDestroyBuffer, deviceFunctions, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode checkCreateUniformPool(gnUniformPool pool, gnDeviceHandle device) {
|
gnReturnCode checkCreateUniformPool(gnUniformPool pool, gnDeviceHandle device) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateUniformPool, pool, device);
|
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateUniformPool, deviceFunctions, pool, device);
|
||||||
}
|
}
|
||||||
gnUniform* checkUniformPoolAllocateUniforms(gnUniformPool pool, gnUniformAllocationInfo allocInfo) {
|
gnUniform* checkUniformPoolAllocateUniforms(gnUniformPool pool, gnUniformAllocationInfo allocInfo) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(pool->device->instance);
|
CHECK_RETURNED_FUNCTION(pool->device->instance, _gnUniformPoolAllocateUniforms, deviceFunctions, NULL, pool, allocInfo);
|
||||||
if (nextLayer->deviceFunctions._gnUniformPoolAllocateUniforms == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(pool->device->instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load allocate uniform functions")
|
|
||||||
});
|
|
||||||
resetLayer(pool->device->instance);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return nextLayer->deviceFunctions._gnUniformPoolAllocateUniforms(pool, allocInfo);
|
|
||||||
}
|
}
|
||||||
void checkDestroyUniformPool(gnUniformPool pool) {
|
void checkDestroyUniformPool(gnUniformPool pool) {
|
||||||
CHECK_VOID_FUNCTION(pool->device->instance, _gnDestroyUniformPool, pool);
|
CHECK_VOID_FUNCTION(pool->device->instance, _gnDestroyUniformPool, deviceFunctions, pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkUpdateBufferUniform(gnUniform uniform, gnBufferUniformInfo* bufferInfo) {
|
void checkUpdateBufferUniform(gnUniform uniform, gnBufferUniformInfo* bufferInfo) {
|
||||||
CHECK_VOID_FUNCTION(uniform->pool->device->instance, _gnUpdateBufferUniform, uniform, bufferInfo);
|
CHECK_VOID_FUNCTION(uniform->pool->device->instance, _gnUpdateBufferUniform, deviceFunctions, uniform, bufferInfo);
|
||||||
}
|
}
|
||||||
void checkUpdateStorageUniform(gnUniform uniform, gnStorageUniformInfo* storageInfo) {
|
void checkUpdateStorageUniform(gnUniform uniform, gnStorageUniformInfo* storageInfo) {
|
||||||
CHECK_VOID_FUNCTION(uniform->pool->device->instance, _gnUpdateStorageUniform, uniform, storageInfo);
|
CHECK_VOID_FUNCTION(uniform->pool->device->instance, _gnUpdateStorageUniform, deviceFunctions, uniform, storageInfo);
|
||||||
}
|
}
|
||||||
void checkUpdateImageUniform(gnUniform uniform, gnImageUniformInfo* imageInfo) {
|
void checkUpdateImageUniform(gnUniform uniform, gnImageUniformInfo* imageInfo) {
|
||||||
CHECK_VOID_FUNCTION(uniform->pool->device->instance, _gnUpdateImageUniform, uniform, imageInfo);
|
CHECK_VOID_FUNCTION(uniform->pool->device->instance, _gnUpdateImageUniform, deviceFunctions, uniform, imageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode checkCreateTexture(gnTexture texture, gnDevice device, const gnTextureInfo info) {
|
gnReturnCode checkCreateTexture(gnTexture texture, gnDevice device, const gnTextureInfo info) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateTexture, texture, device, info);
|
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateTexture, deviceFunctions, texture, device, info);
|
||||||
}
|
}
|
||||||
void checkTextureData(gnTextureHandle texture, void* pixelData) {
|
void checkTextureData(gnTextureHandle texture, void* pixelData) {
|
||||||
CHECK_VOID_FUNCTION(texture->device->instance, _gnTextureData, texture, pixelData);
|
CHECK_VOID_FUNCTION(texture->device->instance, _gnTextureData, deviceFunctions, texture, pixelData);
|
||||||
}
|
}
|
||||||
void checkDestroyTexture(gnTexture texture) {
|
void checkDestroyTexture(gnTexture texture) {
|
||||||
CHECK_VOID_FUNCTION(texture->device->instance, _gnDestroyTexture, texture);
|
CHECK_VOID_FUNCTION(texture->device->instance, _gnDestroyTexture, deviceFunctions, texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode checkCreateFence(gnFenceHandle fence, gnOutputDeviceHandle device) {
|
// gnReturnCode checkCreateFence(gnFenceHandle fence, gnOutputDeviceHandle device) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateFence, fence, device);
|
// CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateFence, fence, device);
|
||||||
}
|
// }
|
||||||
void checkWaitForFence(gnFenceHandle fence, uint64_t timeout) {
|
// void checkWaitForFence(gnFenceHandle fence, uint64_t timeout) {
|
||||||
CHECK_VOID_FUNCTION(fence->device->instance, _gnWaitForFence, fence, timeout);
|
// CHECK_VOID_FUNCTION(fence->device->instance, _gnWaitForFence, fence, timeout);
|
||||||
}
|
// }
|
||||||
void checkResetFence(gnFenceHandle fence) {
|
// void checkResetFence(gnFenceHandle fence) {
|
||||||
CHECK_VOID_FUNCTION(fence->device->instance, _gnResetFence, fence);
|
// CHECK_VOID_FUNCTION(fence->device->instance, _gnResetFence, fence);
|
||||||
}
|
// }
|
||||||
void checkDestroyFence(gnFenceHandle fence) {
|
// void checkDestroyFence(gnFenceHandle fence) {
|
||||||
CHECK_VOID_FUNCTION(fence->device->instance, _gnDestroyFence, fence);
|
// CHECK_VOID_FUNCTION(fence->device->instance, _gnDestroyFence, fence);
|
||||||
}
|
// }
|
||||||
|
|
||||||
gnReturnCode checkSubmit(gnOutputDeviceHandle device, gnSubmitInfo info) {
|
gnReturnCode checkSubmit(gnOutputDeviceHandle device, gnSubmitInfo info) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnSubmit, device, info);
|
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnSubmit, deviceFunctions, device, info);
|
||||||
}
|
}
|
||||||
gnReturnCode checkPresent(gnOutputDeviceHandle device, gnPresentInfo info) {
|
gnReturnCode checkPresent(gnOutputDeviceHandle device, gnPresentInfo info) {
|
||||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnPresent, device, info);
|
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnPresent, deviceFunctions, device, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkWaitForDevice(gnOutputDeviceHandle device) {
|
void checkWaitForDevice(gnOutputDeviceHandle device) {
|
||||||
CHECK_VOID_FUNCTION(device->instance, _gnWaitForDevice, device);
|
CHECK_VOID_FUNCTION(device->instance, _gnWaitForDevice, deviceFunctions, device);
|
||||||
}
|
}
|
||||||
|
@@ -1,122 +1,47 @@
|
|||||||
#include "instance_functions.h"
|
#include "instance_functions.h"
|
||||||
#include "core/src/debugger/gryphn_debugger.h"
|
#include "../loader_utils.h"
|
||||||
|
#include <core/src/debugger/gryphn_debugger.h>
|
||||||
#include "core/src/output_device/gryphn_output_device.h"
|
#include "core/src/output_device/gryphn_output_device.h"
|
||||||
#include "core/src/window_surface/gryphn_surface.h"
|
#include "core/src/window_surface/gryphn_surface.h"
|
||||||
|
|
||||||
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceInfo info) {
|
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceInfo info) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(instance);
|
CHECK_FUNCTION_WITH_RETURN_CODE(instance, _gnCreateInstance, instanceFunctions, instance, info);
|
||||||
if (nextLayer->instanceFunctions._gnCreateInstance == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load create instance function")
|
|
||||||
});
|
|
||||||
resetLayer(instance);
|
|
||||||
return GN_FAILED_TO_LOAD_FUNCTION;
|
|
||||||
}
|
|
||||||
return nextLayer->instanceFunctions._gnCreateInstance(instance, info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkDestroyInstance(gnInstance instance) {
|
void checkDestroyInstance(gnInstance instance) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(instance);
|
CHECK_VOID_FUNCTION(instance, _gnDestroyInstance, instanceFunctions, instance);
|
||||||
if (nextLayer->instanceFunctions._gnDestroyInstance == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load destroy instance function")
|
|
||||||
});
|
|
||||||
resetLayer(instance);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
nextLayer->instanceFunctions._gnDestroyInstance(instance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count) {
|
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(instance);
|
CHECK_RETURNED_FUNCTION(instance, _gnGetPhysicalDevices, instanceFunctions, NULL, instance, count);
|
||||||
if (nextLayer->instanceFunctions._gnGetPhysicalDevices == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load get physical devices function")
|
|
||||||
});
|
|
||||||
resetLayer(instance);
|
|
||||||
}
|
|
||||||
return nextLayer->instanceFunctions._gnGetPhysicalDevices(instance, count);
|
|
||||||
}
|
}
|
||||||
gnBool checkQueueCanPresentToSurface(const gnPhysicalDevice device, uint32_t queueIndex, const gnWindowSurfaceHandle windowSurface) {
|
gnBool checkQueueCanPresentToSurface(const gnPhysicalDevice device, uint32_t queueIndex, const gnWindowSurfaceHandle windowSurface) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(device.instance);
|
CHECK_RETURNED_FUNCTION(device.instance, _gnQueueCanPresentToSurface, instanceFunctions, gnFalse, device, queueIndex, windowSurface);
|
||||||
if (nextLayer->instanceFunctions._gnQueueCanPresentToSurface == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(device.instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load queue can present to surface function")
|
|
||||||
});
|
|
||||||
resetLayer(device.instance);
|
|
||||||
return gnFalse;
|
|
||||||
}
|
|
||||||
return nextLayer->instanceFunctions._gnQueueCanPresentToSurface(device, queueIndex, windowSurface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode checkCreateOutputDevice(gnOutputDeviceHandle device, gnInstanceHandle instance, gnOutputDeviceInfo deviceInfo) {
|
gnReturnCode checkCreateOutputDevice(gnOutputDeviceHandle device, gnInstanceHandle instance, gnOutputDeviceInfo deviceInfo) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(device->instance);
|
CHECK_FUNCTION_WITH_RETURN_CODE(instance, _gnCreateOutputDevice, instanceFunctions, device, instance, deviceInfo);
|
||||||
if (nextLayer->instanceFunctions._gnCreateOutputDevice == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(device->instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load create output device function")
|
|
||||||
});
|
|
||||||
resetLayer(device->instance);
|
|
||||||
return GN_FAILED_TO_LOAD_FUNCTION;
|
|
||||||
}
|
|
||||||
return nextLayer->instanceFunctions._gnCreateOutputDevice(device, instance, deviceInfo);
|
|
||||||
}
|
}
|
||||||
void checkDestroyOutputDevice(gnOutputDeviceHandle device) {
|
void checkDestroyOutputDevice(gnOutputDeviceHandle device) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(device->instance);
|
CHECK_VOID_FUNCTION(device->instance, _gnDestroyOutputDevice, instanceFunctions, device);
|
||||||
if (nextLayer->instanceFunctions._gnDestroyOutputDevice == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(device->instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load destroy output device function")
|
|
||||||
});
|
|
||||||
resetLayer(device->instance);
|
|
||||||
}
|
|
||||||
return nextLayer->instanceFunctions._gnDestroyOutputDevice(device);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GN_PLATFORM_MACOS
|
#ifdef GN_PLATFORM_MACOS
|
||||||
gnReturnCode checkCreateSurfaceMacOS(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, gnMacOSWindowSurfaceInfo createInfo) {
|
gnReturnCode checkCreateSurfaceMacOS(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, gnMacOSWindowSurfaceInfo createInfo) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(instance);
|
CHECK_FUNCTION_WITH_RETURN_CODE(instance, _gnCreateMacOSWindowSurface, instanceFunctions, surface, instance, info);
|
||||||
if (nextLayer->instanceFunctions._gnCreateMacOSWindowSurface == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load create window surface function")
|
|
||||||
});
|
|
||||||
resetLayer(instance);
|
|
||||||
return GN_FAILED_TO_LOAD_FUNCTION;
|
|
||||||
}
|
|
||||||
return nextLayer->instanceFunctions._gnCreateMacOSWindowSurface(windowSurface, instance, createInfo);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef GN_PLATFORM_LINUX
|
#ifdef GN_PLATFORM_LINUX
|
||||||
#ifdef GN_WINDOW_X11
|
#ifdef GN_WINDOW_X11
|
||||||
gnReturnCode checkCreateX11WindowSurface(gnWindowSurface surface, gnInstance instance, gnX11WindowSurfaceInfo info) {
|
gnReturnCode checkCreateX11WindowSurface(gnWindowSurface surface, gnInstance instance, gnX11WindowSurfaceInfo info) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(instance);
|
CHECK_FUNCTION_WITH_RETURN_CODE(instance, _gnCreateX11WindowSurface, instanceFunctions, surface, instance, info);
|
||||||
if (nextLayer->instanceFunctions._gnCreateX11WindowSurface == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load _gnCreateX11WindowSurface this may indicate a bug within gryphn")
|
|
||||||
});
|
|
||||||
resetLayer(instance);
|
|
||||||
return GN_FAILED_TO_LOAD_FUNCTION;
|
|
||||||
}
|
|
||||||
return nextLayer->instanceFunctions._gnCreateX11WindowSurface(surface, instance, info);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void checkDestroyWindowSurface(gnWindowSurfaceHandle windowSurface) {
|
void checkDestroyWindowSurface(gnWindowSurfaceHandle windowSurface) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(windowSurface->instance);
|
CHECK_VOID_FUNCTION(windowSurface->instance, _gnDestroyWindowSurface, instanceFunctions, windowSurface);
|
||||||
if (nextLayer->instanceFunctions._gnDestroyWindowSurface == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(windowSurface->instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load destroy create surface function")
|
|
||||||
});
|
|
||||||
resetLayer(windowSurface->instance);
|
|
||||||
}
|
|
||||||
return nextLayer->instanceFunctions._gnDestroyWindowSurface(windowSurface);
|
|
||||||
}
|
}
|
||||||
gnSurfaceDetails checkGetSurfaceDetails(gnWindowSurfaceHandle windowSurface, gnPhysicalDevice device) {
|
gnSurfaceDetails checkGetSurfaceDetails(gnWindowSurfaceHandle windowSurface, gnPhysicalDevice device) {
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(windowSurface->instance);
|
CHECK_RETURNED_FUNCTION(windowSurface->instance, _gnGetSurfaceDetails, instanceFunctions, (gnSurfaceDetails){}, windowSurface, device);
|
||||||
if (nextLayer->instanceFunctions._gnGetSurfaceDetails == NULL) {
|
|
||||||
gnDebuggerSetErrorMessage(windowSurface->instance->debugger, (gnMessageData){
|
|
||||||
.message = gnCreateString("Failed to load get surface details function")
|
|
||||||
});
|
|
||||||
resetLayer(windowSurface->instance);
|
|
||||||
}
|
|
||||||
return nextLayer->instanceFunctions._gnGetSurfaceDetails(windowSurface, device);
|
|
||||||
}
|
}
|
||||||
|
@@ -1,43 +0,0 @@
|
|||||||
#define CHECK_FUNCTION_WITH_RETURN_CODE(instance, function, ...) \
|
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(instance); \
|
|
||||||
if (nextLayer->deviceFunctions.function == NULL) { \
|
|
||||||
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){ \
|
|
||||||
.message = gnCreateString("Failed to load " #function " this indicates a bug within gryphn") \
|
|
||||||
}); \
|
|
||||||
resetLayer(instance); \
|
|
||||||
return GN_FAILED_TO_LOAD_FUNCTION; \
|
|
||||||
} \
|
|
||||||
return nextLayer->deviceFunctions.function(__VA_ARGS__);
|
|
||||||
|
|
||||||
#define CHECK_FUNCTION_WITH_RETURN_CODE_COMMAND(instance, function, ...) \
|
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(instance); \
|
|
||||||
if (nextLayer->commandFunctions.function == NULL) { \
|
|
||||||
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){ \
|
|
||||||
.message = gnCreateString("Failed to load " #function " this indicates a bug within gryphn") \
|
|
||||||
}); \
|
|
||||||
resetLayer(instance); \
|
|
||||||
return GN_FAILED_TO_LOAD_FUNCTION; \
|
|
||||||
} \
|
|
||||||
return nextLayer->commandFunctions.function(__VA_ARGS__);
|
|
||||||
|
|
||||||
#define CHECK_VOID_FUNCTION(instance, function, ...) \
|
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(instance); \
|
|
||||||
if (nextLayer->deviceFunctions.function == NULL) { \
|
|
||||||
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){ \
|
|
||||||
.message = gnCreateString("Failed to load " #function " this indicates a bug within gryphn") \
|
|
||||||
}); \
|
|
||||||
resetLayer(instance); \
|
|
||||||
return; \
|
|
||||||
} \
|
|
||||||
nextLayer->deviceFunctions.function(__VA_ARGS__);
|
|
||||||
|
|
||||||
#define CHECK_VOID_FUNCTION_COMMAND(instance, function, ...) \
|
|
||||||
loaderLayer* nextLayer = loaderGetNextLayer(instance); \
|
|
||||||
if (nextLayer->commandFunctions.function == NULL) { \
|
|
||||||
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){ \
|
|
||||||
.message = gnCreateString("Failed to load " #function " this indicates a bug within gryphn") \
|
|
||||||
}); \
|
|
||||||
resetLayer(instance); \
|
|
||||||
return; \
|
|
||||||
} \
|
|
||||||
nextLayer->commandFunctions.function(__VA_ARGS__);
|
|
Reference in New Issue
Block a user