diff --git a/CMakeLists.txt b/CMakeLists.txt index 0156312..b97c02d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,10 +9,12 @@ if (UNIX AND NOT APPLE) GN_PLATFORM_LINUX GN_WINDOW_X11 - GN_API_VULKAN + GN_API_VULKAN GN_API_OPENGL ) - set(VULKAN_BUILT ON) add_subdirectory(projects/apis/vulkan/) + add_subdirectory(projects/apis/opengl/) + set(VULKAN_BUILT ON) + set(OPENGL_BUILT ON) endif() if (APPLE) add_compile_definitions( @@ -39,3 +41,6 @@ endif() if (METAL_BUILT) target_link_libraries(Gryphn INTERFACE GryphnMetalImpl) endif() +if (OPENGL_BUILT) + target_link_libraries(Gryphn INTERFACE GryphnOpenGLImpl) +endif() diff --git a/projects/apis/opengl/CMakeLists.txt b/projects/apis/opengl/CMakeLists.txt new file mode 100644 index 0000000..93d5cd2 --- /dev/null +++ b/projects/apis/opengl/CMakeLists.txt @@ -0,0 +1,23 @@ +set(CMAKE_EXPORT_COMPILE_COMMANDS on) +set(CMAKE_CXX_STANDARD 17) +project(GryphnOpenGLImpl) + +file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS + "src/*.c" +) +file(GLOB_RECURSE LOADER_FILES CONFIGURE_DEPENDS + "loader/*.c" +) +add_library(GryphnOpenGLImpl STATIC ${SOURCE_FILES} ${LOADER_FILES}) +target_include_directories(GryphnOpenGLImpl PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/src/ + ${CMAKE_CURRENT_SOURCE_DIR}/../../core/src/ + ${CMAKE_CURRENT_SOURCE_DIR}/../../core/ + ${CMAKE_CURRENT_SOURCE_DIR}/../../extensions/ + ${CMAKE_CURRENT_SOURCE_DIR}/../../utils/ + ${CMAKE_CURRENT_SOURCE_DIR}/../../platform/ + ${CMAKE_CURRENT_SOURCE_DIR}/../../ + ${CMAKE_CURRENT_SOURCE_DIR}/../../../include/ +) +add_compile_definitions(GN_REVEAL_IMPL) +target_link_libraries(GryphnOpenGLImpl GL) diff --git a/projects/apis/opengl/loader/opengl_instance_loader.c b/projects/apis/opengl/loader/opengl_instance_loader.c new file mode 100644 index 0000000..b66e65f --- /dev/null +++ b/projects/apis/opengl/loader/opengl_instance_loader.c @@ -0,0 +1,16 @@ +#include "opengl_loader.h" +#include "instance/opengl_instance.h" + +gnInstanceFunctions loadOpenGLInstanceFunctions() { + return (gnInstanceFunctions){ + ._gnCreateInstance = createOpenGLInstance, + ._gnDestroyInstance = destroyOpenGLInstance, + // ._gnGetPhysicalDevices = getMetalDevices, + // ._gnQueueCanPresentToSurface = metalCanQueuePresentToSurface, + // ._gnCreateOutputDevice = createMetalOutputDevice, + // ._gnDestroyOutputDevice = destroyMetalOutputDevice, + // ._gnCreateMacOSWindowSurface = createMetalSurface, + // ._gnDestroyWindowSurface = destroyMetalWindowSurface, + // ._gnGetSurfaceDetails = getMetalSurfaceDetails + }; +} diff --git a/projects/apis/opengl/loader/opengl_loader.h b/projects/apis/opengl/loader/opengl_loader.h new file mode 100644 index 0000000..588caf5 --- /dev/null +++ b/projects/apis/opengl/loader/opengl_loader.h @@ -0,0 +1,8 @@ +#pragma once +#include "loader/src/gryphn_instance_functions.h" +#include "loader/src/gryphn_device_functions.h" +#include "loader/src/gryphn_command_functions.h" + +gnInstanceFunctions loadOpenGLInstanceFunctions(); +gnDeviceFunctions loadOpenGLDeviceFunctions(); +gnCommandFunctions loadOpenGLCommandFunctions(); diff --git a/projects/apis/opengl/src/instance/opengl_instance.c b/projects/apis/opengl/src/instance/opengl_instance.c new file mode 100644 index 0000000..00cb916 --- /dev/null +++ b/projects/apis/opengl/src/instance/opengl_instance.c @@ -0,0 +1,8 @@ +#include "opengl_instance.h" + +gnReturnCode createOpenGLInstance(gnInstanceHandle instance, gnInstanceInfo instanceInfo) { + return GN_SUCCESS; +} +void destroyOpenGLInstance(gnInstanceHandle instance) { + +} diff --git a/projects/apis/opengl/src/instance/opengl_instance.h b/projects/apis/opengl/src/instance/opengl_instance.h new file mode 100644 index 0000000..8ca0895 --- /dev/null +++ b/projects/apis/opengl/src/instance/opengl_instance.h @@ -0,0 +1,8 @@ +#pragma once +#include +#include "instance/gryphn_instance.h" + +typedef struct gnPlatformInstance_t {} gnPlatformInstance; + +gnReturnCode createOpenGLInstance(gnInstanceHandle instance, gnInstanceInfo instanceInfo); +void destroyOpenGLInstance(gnInstanceHandle instance);