Some checks failed
Ubuntu Cross to Win64 / Cross Compile with ming64 (1.4.0, ubuntu-latest) (push) Failing after 1m50s
56 lines
1.5 KiB
C
56 lines
1.5 KiB
C
#include <renderer/backend_api.h>
|
|
#include <runtime/runtime.h>
|
|
#include <runtime/config.h>
|
|
|
|
#include "device.h"
|
|
|
|
extern rt_cvar r_VkEnableAPIAllocTracking;
|
|
extern rt_cvar r_VkPhysDeviceName;
|
|
extern rt_cvar r_VkMaxFramesInFlight;
|
|
extern rt_cvar r_VkPreferMailboxMode;
|
|
|
|
void VkRegisterCVARs(void) {
|
|
rtRegisterCVAR(&r_VkEnableAPIAllocTracking);
|
|
rtRegisterCVAR(&r_VkPhysDeviceName);
|
|
rtRegisterCVAR(&r_VkMaxFramesInFlight);
|
|
#if 0
|
|
rtRegisterCVAR(&r_VkPreferredSwapchainImages);
|
|
rtRegisterCVAR(&r_VkPreferMailboxMode);
|
|
#endif
|
|
}
|
|
|
|
static rt_vk_device _device;
|
|
|
|
rt_render_backend_init_result VkInit(const rt_renderer_window_info *info) {
|
|
rt_render_backend_init_result res = {.result = RT_SUCCESS};
|
|
|
|
rt_create_vk_device_result device_result = rtCreateVkDevice(info);
|
|
if (device_result.result != RT_SUCCESS) {
|
|
res.result = device_result.result;
|
|
return res;
|
|
}
|
|
/* Populate the device interface */
|
|
_device = device_result.device;
|
|
rt_render_device_i device_i = {
|
|
.o = &_device,
|
|
.GetPhysicalResourceManager = rtVkDevGetPhysicalResourceManager,
|
|
};
|
|
res.device = device_i;
|
|
|
|
return res;
|
|
}
|
|
|
|
void VkShutdown(void) {
|
|
rtDestroyVkDevice(&_device);
|
|
}
|
|
|
|
// Called by the application to retrieve the renderer api
|
|
RT_DLLEXPORT rt_render_backend_api rtLoadRenderBackendImpl(void) {
|
|
rt_render_backend_api api = {
|
|
.RegisterCVARs = VkRegisterCVARs,
|
|
.Init = VkInit,
|
|
.Shutdown = VkShutdown,
|
|
};
|
|
return api;
|
|
}
|