reuse command buffers flag
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
#include "command_functions.h"
|
||||
#include "core/src/command/command_pool/gryphn_command_pool.h"
|
||||
#include "core/src/command/command_buffer/gryphn_command_buffer.h"
|
||||
#include "core/src/output_device/gryphn_output_device.h"
|
||||
#include <core/src/debugger/gryphn_debugger.h>
|
||||
#include <core/src/instance/gryphn_instance.h>
|
||||
#include "core/src/renderpass/gryphn_render_pass.h"
|
||||
#include "core/src/pipelines/graphics_pipeline/gryphn_graphics_pipeline.h"
|
||||
#include "core/src/buffers/gryphn_buffer.h"
|
||||
#include "loader_utils.h"
|
||||
|
||||
gnReturnCode checkCommandPoolAllocateCommandBuffers(gnCommandBufferHandle* commandBuffers, uint32_t count, gnCommandPoolHandle pool) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE_COMMAND(pool->device->instance, _gnCommandPoolAllocateCommandBuffers, commandBuffers, count, pool);
|
||||
}
|
||||
gnReturnCode checkBeginCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE_COMMAND(commandBuffer->instance, _gnBeginCommandBuffer, commandBuffer);
|
||||
}
|
||||
void checkResetCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||
CHECK_VOID_FUNCTION_COMMAND(commandBuffer->instance, _gnResetCommandBuffer, commandBuffer);
|
||||
}
|
||||
gnReturnCode checkEndCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE_COMMAND(commandBuffer->instance, _gnEndCommandBuffer, commandBuffer);
|
||||
}
|
||||
void checkDestroyCommandBuffer(gnCommandBufferHandle buffer) {
|
||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnDestroyCommandBuffer, buffer);
|
||||
}
|
||||
|
||||
void checkCommandBeginRenderPass(gnCommandBufferHandle buffer, gnRenderPassInfo passInfo) {
|
||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandBeginRenderPass, buffer, passInfo);
|
||||
}
|
||||
void checkCommandEndRenderPass(gnCommandBufferHandle buffer) {
|
||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandEndRenderPass, buffer);
|
||||
}
|
||||
|
||||
void checkCommandBindGraphicsPipeline(gnCommandBufferHandle buffer, gnGraphicsPipelineHandle graphicsPipeline) {
|
||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandBindGraphicsPipeline, buffer, graphicsPipeline);
|
||||
}
|
||||
void checkCommandSetViewport(gnCommandBufferHandle buffer, gnViewport viewport) {
|
||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandSetViewport, buffer, viewport);
|
||||
}
|
||||
void checkCommandSetScissor(gnCommandBufferHandle buffer, gnScissor scissor) {
|
||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandSetScissor, buffer, scissor);
|
||||
}
|
||||
void checkCommandBindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set) {
|
||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandBindUniform, buffer, uniform, set);
|
||||
}
|
||||
void checkCommandPushConstant(gnCommandBufferHandle buffer, gnPushConstantLayout layout, void* data) {
|
||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandPushConstant, buffer, layout, data);
|
||||
}
|
||||
|
||||
void checkCommandBindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type) {
|
||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandBindBuffer, buffer, bufferToBind, type);
|
||||
}
|
||||
void checkCommandDraw(gnCommandBufferHandle buffer, int vertexCount, int firstVertex, int instanceCount, int firstInstance) {
|
||||
CHECK_VOID_FUNCTION_COMMAND(buffer->instance, _gnCommandDraw, buffer, vertexCount, firstVertex, instanceCount, 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);
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
#include "loader/src/gryphn_command_functions.h"
|
||||
|
||||
gnReturnCode checkCommandPoolAllocateCommandBuffers(gnCommandBufferHandle* commandBuffers, uint32_t count, gnCommandPoolHandle pool);
|
||||
gnReturnCode checkBeginCommandBuffer(gnCommandBufferHandle commandBuffer);
|
||||
void checkResetCommandBuffer(gnCommandBufferHandle commandBuffer);
|
||||
gnReturnCode checkEndCommandBuffer(gnCommandBufferHandle commandBuffer);
|
||||
void checkDestroyCommandBuffer(gnCommandBufferHandle commandBuffer);
|
||||
|
||||
void checkCommandBeginRenderPass(gnCommandBufferHandle buffer, gnRenderPassInfo passInfo);
|
||||
void checkCommandEndRenderPass(gnCommandBufferHandle buffer);
|
||||
|
||||
void checkCommandBindGraphicsPipeline(gnCommandBufferHandle buffer, gnGraphicsPipelineHandle graphicsPipeline);
|
||||
void checkCommandSetViewport(gnCommandBufferHandle buffer, gnViewport viewport);
|
||||
void checkCommandSetScissor(gnCommandBufferHandle buffer, gnScissor scissor);
|
||||
void checkCommandBindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set);
|
||||
void checkCommandPushConstant(gnCommandBufferHandle buffer, gnPushConstantLayout layout, void* data);
|
||||
|
||||
void checkCommandBindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type);
|
||||
void checkCommandDraw(gnCommandBufferHandle buffer, int vertexCount, int firstVertex, int instanceCount, int firstInstance);
|
||||
void checkCommandDrawIndexed(gnCommandBufferHandle buffer, gnIndexType type, int indexCount, int firstIndex, int vertexOffset, int instanceCount, int firstInstance);
|
@@ -0,0 +1,185 @@
|
||||
#include "device_functions.h"
|
||||
#include "loader_utils.h"
|
||||
#include "core/src/debugger/gryphn_debugger.h"
|
||||
#include "core/src/presentation_queue/gryphn_presentation_queue.h"
|
||||
#include "core/src/shader_module/gryphn_shader_module.h"
|
||||
#include "core/src/renderpass/gryphn_render_pass_descriptor.h"
|
||||
#include "core/src/pipelines/graphics_pipeline/gryphn_graphics_pipeline.h"
|
||||
#include "core/src/framebuffer/gryphn_framebuffer.h"
|
||||
#include "core/src/command/command_pool/gryphn_command_pool.h"
|
||||
#include "core/src/buffers/gryphn_buffer.h"
|
||||
#include "core/src/uniforms/gryphn_uniform_pool.h"
|
||||
#include "core/src/textures/gryphn_texture.h"
|
||||
#include "core/src/sync/fence/gryphn_fence.h"
|
||||
#include "core/src/submit/gryphn_submit.h"
|
||||
#include "core/src/present/gryphn_present.h"
|
||||
|
||||
gnReturnCode checkCreatePresentationQueue(gnPresentationQueueHandle presentationQueue, const gnOutputDeviceHandle device, gnPresentationQueueInfo presentationInfo){
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(presentationQueue->outputDevice->instance);
|
||||
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 checkPresentationQueueGetImage(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(presentationQueue->outputDevice->instance);
|
||||
if (nextLayer->deviceFunctions._gnPresentationQueueGetImage == NULL) {
|
||||
gnDebuggerSetErrorMessage(presentationQueue->outputDevice->instance->debugger, (gnMessageData){
|
||||
.message = gnCreateString("Failed to load presentation queue get image function")
|
||||
});
|
||||
resetLayer(presentationQueue->outputDevice->instance);
|
||||
return GN_FAILED_TO_LOAD_FUNCTION;
|
||||
}
|
||||
return nextLayer->deviceFunctions._gnPresentationQueueGetImage(presentationQueue, timeout, semaphore, imageIndex);
|
||||
}
|
||||
void checkDestroyPresentationQueue(gnPresentationQueueHandle presentationQueue) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(presentationQueue->outputDevice->instance);
|
||||
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) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(device->instance);
|
||||
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){
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(module->device->instance);
|
||||
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) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateRenderPassDescriptor, renderPass, device, info);
|
||||
}
|
||||
void checkDestroyRenderPassDescriptor(gnRenderPassDescriptorHandle renderPass) {
|
||||
CHECK_VOID_FUNCTION(renderPass->device->instance, _gnDestroyRenderPassDescriptor, renderPass);
|
||||
}
|
||||
|
||||
gnReturnCode checkCreateGraphicsPipeline(gnGraphicsPipelineHandle pipeline, gnOutputDeviceHandle device, gnGraphicsPipelineInfo info) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateGraphicsPipeline, pipeline, device, info);
|
||||
}
|
||||
void checkDestroyGraphicsPipeline(gnGraphicsPipelineHandle pipeline) {
|
||||
CHECK_VOID_FUNCTION(pipeline->device->instance, _gnDestroyGraphicsPipeline, pipeline);
|
||||
}
|
||||
|
||||
gnReturnCode checkCreateFramebuffer(gnFramebuffer framebuffer, gnOutputDeviceHandle device, gnFramebufferInfo framebufferInfo) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateFramebuffer, framebuffer, device, framebufferInfo);
|
||||
}
|
||||
void checkDestroyFramebuffer(gnFramebuffer framebuffer) {
|
||||
CHECK_VOID_FUNCTION(framebuffer->device->instance, _gnDestroyFramebuffer, framebuffer);
|
||||
}
|
||||
|
||||
gnReturnCode checkCreateCommandPool(gnCommandPoolHandle commandPool, gnOutputDeviceHandle device, gnCommandPoolInfo info) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateCommandPool, commandPool, device, info);
|
||||
}
|
||||
void checkDestroyCommandPool(gnCommandPoolHandle commandPool) {
|
||||
CHECK_VOID_FUNCTION(commandPool->device->instance, _gnDestroyCommandPool, commandPool);
|
||||
}
|
||||
|
||||
gnReturnCode checkCreateSemaphore(gnSemaphoreHandle semaphore, gnOutputDeviceHandle device) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateSemaphore, semaphore, device);
|
||||
}
|
||||
void checkDestroySemaphore(gnSemaphoreHandle semaphore) {
|
||||
CHECK_VOID_FUNCTION(semaphore->device->instance, _gnDestroySemaphore, semaphore);
|
||||
}
|
||||
|
||||
gnReturnCode checkCreateBuffer(gnBufferHandle buffer, gnDeviceHandle device, gnBufferInfo info) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateBuffer, buffer, device, info);
|
||||
}
|
||||
void checkBufferData(gnBufferHandle buffer, size_t size, void* data) {
|
||||
CHECK_VOID_FUNCTION(buffer->device->instance, _gnBufferData, buffer, size, data);
|
||||
}
|
||||
void* checkMapBuffer(gnBufferHandle buffer) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(buffer->device->instance);
|
||||
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) {
|
||||
CHECK_VOID_FUNCTION(buffer->device->instance, _gnDestroyBuffer, buffer);
|
||||
}
|
||||
|
||||
gnReturnCode checkCreateUniformPool(gnUniformPool pool, gnDeviceHandle device) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateUniformPool, pool, device);
|
||||
}
|
||||
gnUniform* checkUniformPoolAllocateUniforms(gnUniformPool pool, gnUniformAllocationInfo allocInfo) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(pool->device->instance);
|
||||
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) {
|
||||
CHECK_VOID_FUNCTION(pool->device->instance, _gnDestroyUniformPool, pool);
|
||||
}
|
||||
|
||||
void checkUpdateBufferUniform(gnUniform uniform, gnBufferUniformInfo* bufferInfo) {
|
||||
CHECK_VOID_FUNCTION(uniform->pool->device->instance, _gnUpdateBufferUniform, uniform, bufferInfo);
|
||||
}
|
||||
void checkUpdateImageUniform(gnUniform uniform, gnImageUniformInfo* imageInfo) {
|
||||
CHECK_VOID_FUNCTION(uniform->pool->device->instance, _gnUpdateImageUniform, uniform, imageInfo);
|
||||
}
|
||||
|
||||
gnReturnCode checkCreateTexture(gnTexture texture, gnDevice device, const gnTextureInfo info) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateTexture, texture, device, info);
|
||||
}
|
||||
void checkTextureData(gnTextureHandle texture, void* pixelData) {
|
||||
CHECK_VOID_FUNCTION(texture->device->instance, _gnTextureData, texture, pixelData);
|
||||
}
|
||||
void checkDestroyTexture(gnTexture texture) {
|
||||
CHECK_VOID_FUNCTION(texture->device->instance, _gnDestroyTexture, texture);
|
||||
}
|
||||
|
||||
gnReturnCode checkCreateFence(gnFenceHandle fence, gnOutputDeviceHandle device) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnCreateFence, fence, device);
|
||||
}
|
||||
void checkWaitForFence(gnFenceHandle fence, uint64_t timeout) {
|
||||
CHECK_VOID_FUNCTION(fence->device->instance, _gnWaitForFence, fence, timeout);
|
||||
}
|
||||
void checkResetFence(gnFenceHandle fence) {
|
||||
CHECK_VOID_FUNCTION(fence->device->instance, _gnResetFence, fence);
|
||||
}
|
||||
void checkDestroyFence(gnFenceHandle fence) {
|
||||
CHECK_VOID_FUNCTION(fence->device->instance, _gnDestroyFence, fence);
|
||||
}
|
||||
|
||||
gnReturnCode checkSubmit(gnOutputDeviceHandle device, gnSubmitInfo info) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnSubmit, device, info);
|
||||
}
|
||||
gnReturnCode checkPresent(gnOutputDeviceHandle device, gnPresentInfo info) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnPresent, device, info);
|
||||
}
|
||||
|
||||
void checkWaitForDevice(gnOutputDeviceHandle device) {
|
||||
CHECK_VOID_FUNCTION(device->instance, _gnWaitForDevice, device);
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
#include "loader/src/gryphn_device_functions.h"
|
||||
|
||||
gnReturnCode checkCreatePresentationQueue(gnPresentationQueueHandle presentationQueue, const gnOutputDeviceHandle device, gnPresentationQueueInfo presentationInfo);
|
||||
gnReturnCode checkPresentationQueueGetImage(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex);
|
||||
void checkDestroyPresentationQueue(gnPresentationQueueHandle presentationQueue);
|
||||
|
||||
gnReturnCode checkCreateShaderModule(gnShaderModuleHandle module, gnOutputDeviceHandle device, gnShaderModuleInfo shaderModuleInfo);
|
||||
void checkDestroyShaderModule(gnShaderModuleHandle module);
|
||||
|
||||
gnReturnCode checkCreateRenderPassDescriptor(gnRenderPassDescriptorHandle renderPass, gnOutputDeviceHandle device, gnRenderPassDescriptorInfo info);
|
||||
void checkDestroyRenderPassDescriptor(gnRenderPassDescriptorHandle renderPass);
|
||||
|
||||
gnReturnCode checkCreateGraphicsPipeline(gnGraphicsPipelineHandle pipeline, gnOutputDeviceHandle device, gnGraphicsPipelineInfo pipelineInfo);
|
||||
void checkDestroyGraphicsPipeline(gnGraphicsPipelineHandle pipeline);
|
||||
|
||||
gnReturnCode checkCreateFramebuffer(gnFramebuffer framebuffer, gnOutputDeviceHandle device, gnFramebufferInfo framebufferInfo);
|
||||
void checkDestroyFramebuffer(gnFramebuffer framebuffer);
|
||||
|
||||
gnReturnCode checkCreateCommandPool(gnCommandPoolHandle commandPool, gnOutputDeviceHandle device, gnCommandPoolInfo info);
|
||||
void checkDestroyCommandPool(gnCommandPoolHandle commandPool);
|
||||
|
||||
gnReturnCode checkCreateSemaphore(gnSemaphoreHandle semaphore, gnOutputDeviceHandle device);
|
||||
void checkDestroySemaphore(gnSemaphoreHandle semaphore);
|
||||
|
||||
gnReturnCode checkCreateBuffer(gnBufferHandle buffer, gnDeviceHandle device, gnBufferInfo info);
|
||||
void checkBufferData(gnBufferHandle buffer, size_t size, void* data);
|
||||
void* checkMapBuffer(gnBufferHandle buffer);
|
||||
void checkDestroyBuffer(gnBufferHandle buffer);
|
||||
|
||||
gnReturnCode checkCreateUniformPool(gnUniformPool pool, gnDeviceHandle device);
|
||||
gnUniform* checkUniformPoolAllocateUniforms(gnUniformPool pool, gnUniformAllocationInfo allocInfo);
|
||||
void checkDestroyUniformPool(gnUniformPool pool);
|
||||
|
||||
void checkUpdateBufferUniform(gnUniform uniform, gnBufferUniformInfo* bufferInfo);
|
||||
void checkUpdateImageUniform(gnUniform uniform, gnImageUniformInfo* imageInfo);
|
||||
|
||||
gnReturnCode checkCreateTexture(gnTexture texture, gnDevice device, const gnTextureInfo info);
|
||||
void checkTextureData(gnTextureHandle texture, void* pixelData);
|
||||
void checkDestroyTexture(gnTexture texture);
|
||||
|
||||
gnReturnCode checkCreateFence(gnFenceHandle fence, gnOutputDeviceHandle device);
|
||||
void checkWaitForFence(gnFenceHandle fence, uint64_t timeout);
|
||||
void checkResetFence(gnFenceHandle fence);
|
||||
void checkDestroyFence(gnFenceHandle fence);
|
||||
|
||||
gnReturnCode checkSubmit(gnOutputDeviceHandle device, gnSubmitInfo submit);
|
||||
gnReturnCode checkPresent(gnOutputDeviceHandle device, gnPresentInfo info);
|
||||
|
||||
void checkWaitForDevice(gnOutputDeviceHandle device);
|
@@ -0,0 +1,105 @@
|
||||
#include "instance_functions.h"
|
||||
#include "core/src/debugger/gryphn_debugger.h"
|
||||
#include "core/src/output_device/gryphn_output_device.h"
|
||||
#include "core/src/window_surface/gryphn_surface.h"
|
||||
|
||||
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceInfo info) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(instance);
|
||||
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) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(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) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(instance);
|
||||
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) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(device.instance);
|
||||
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) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(device->instance);
|
||||
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) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(device->instance);
|
||||
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);
|
||||
}
|
||||
|
||||
gnReturnCode checkCreateSurfaceMacOS(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, gnMacOSWindowSurfaceInfo createInfo) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(instance);
|
||||
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);
|
||||
}
|
||||
|
||||
void checkDestroyWindowSurface(gnWindowSurfaceHandle windowSurface) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(windowSurface->instance);
|
||||
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) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(windowSurface->instance);
|
||||
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);
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include "core/src/instance/gryphn_instance.h"
|
||||
#include <core/src/window_surface/gryphn_surface_create_functions.h>
|
||||
|
||||
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceInfo info);
|
||||
void checkDestroyInstance(gnInstance instance);
|
||||
|
||||
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count);
|
||||
gnBool checkQueueCanPresentToSurface(const gnPhysicalDevice device, uint32_t queueIndex, const gnWindowSurfaceHandle windowSurface);
|
||||
|
||||
gnReturnCode checkCreateOutputDevice(gnOutputDeviceHandle device, gnInstanceHandle instance, gnOutputDeviceInfo deviceInfo);
|
||||
void checkDestroyOutputDevice(gnOutputDeviceHandle device);
|
||||
|
||||
#ifdef GN_PLATFORM_MACOS
|
||||
gnReturnCode checkCreateSurfaceMacOS(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, gnMacOSWindowSurfaceInfo createInfo);
|
||||
#endif
|
||||
|
||||
void checkDestroyWindowSurface(gnWindowSurfaceHandle windowSurface);
|
||||
gnSurfaceDetails checkGetSurfaceDetails(gnWindowSurfaceHandle windowSurface, gnPhysicalDevice device);
|
@@ -0,0 +1,43 @@
|
||||
#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