move some shit around (DOES NOT COMPILE)

This commit is contained in:
Gregory Wells
2025-06-24 12:03:14 -04:00
parent 4b8eb58388
commit 7a80d0fd61
144 changed files with 177 additions and 180 deletions

3
.gitmodules vendored
View File

@@ -1,3 +1,6 @@
[submodule "src/utils"] [submodule "src/utils"]
path = src/utils path = src/utils
url = https://github.com/GregoryWells2007/GryphnUtils.git url = https://github.com/GregoryWells2007/GryphnUtils.git
[submodule "src/apis/metal/depends/SPIRV-Cross"]
path = src/apis/metal/depends/SPIRV-Cross
url = https://github.com/KhronosGroup/SPIRV-Cross.git

View File

@@ -1,46 +1,50 @@
set(CMAKE_EXPORT_COMPILE_COMMANDS on) set(CMAKE_EXPORT_COMPILE_COMMANDS on)
project(Gryphn) project(Gryphn)
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS add_compile_definitions(GN_PLATFORM_LINUX GN_WINDOW_X11 GN_REVEAL_IMPL)
"src/*.cpp" "src/*.hpp"
"src/*.c" "src/*.h"
)
if(APPLE)
file(GLOB_RECURSE METAL_FILES CONFIGURE_DEPENDS "src/*.m")
endif()
add_library(Gryphn ${SOURCE_FILES} ${METAL_FILES})
target_include_directories(Gryphn PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/)
target_include_directories(Gryphn PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include/)
target_include_directories(Gryphn PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/utils)
target_include_directories(Gryphn PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/utils/utils)
add_compile_definitions(GN_REVEAL_IMPL)
make_directory(${CMAKE_BINARY_DIR}/gryphn/rendering_apis/) add_subdirectory(src/core/) # build gryphn code
add_subdirectory(src/apis/vulkan/)
if(WIN32) add_library(Gryphn INTERFACE)
add_compile_definitions(GN_PLATFORM_WIN32) target_link_libraries(Gryphn INTERFACE GryphnCore GryphnVulkanImpl)
# add_subdirectory(rendering_api/dirctx/)
add_subdirectory(rendering_api/vulkan/)
endif()
if(APPLE)
add_compile_definitions(GN_PLATFORM_MACOS)
add_subdirectory(rendering_api/metal/)
add_subdirectory(rendering_api/vulkan/)
target_link_libraries(Gryphn # set(CMAKE_EXPORT_COMPILE_COMMANDS on)
"-framework IOKit" # project(Gryphn)
"-framework CoreFoundation" # add_library(Gryphn STATIC "")
"-framework CoreGraphics"
"-framework AppKit"
"-framework Metal"
"-framework QuartzCore"
"-framework MetalKit"
)
endif()
if(UNIX AND NOT APPLE)
add_compile_definitions(GN_PLATFORM_LINUX)
add_compile_definitions(GN_WINDOW_X11)
add_subdirectory(rendering_api/vulkan/)
endif()
target_link_libraries(Gryphn) # # build gryphn core
# add_subdirectory(src/core/)
# target_link_libraries(Gryphn GryphnCore)
# # build the selected apis
# if(WIN32)
# add_compile_definitions(GN_PLATFORM_WIN32)
# add_subdirectory(src/apis/vulkan/)
# target_link_libraries(Gryphn GryphnVulkanImpl)
# endif()
# if(APPLE)
# add_compile_definitions(GN_PLATFORM_MACOS)
# add_subdirectory(src/apis/metal/)
# add_subdirectory(src/apis/vulkan/)
# target_link_libraries(Gryphn
# "-framework IOKit"
# "-framework CoreFoundation"
# "-framework CoreGraphics"
# "-framework AppKit"
# "-framework Metal"
# "-framework QuartzCore"
# "-framework MetalKit"
# )
# target_link_libraries(Gryphn GryphnVulkanImpl GryphnMetalImpl)
# endif()
# if(UNIX AND NOT APPLE)
# add_compile_definitions(GN_PLATFORM_LINUX)
# add_compile_definitions(GN_WINDOW_X11)
# add_subdirectory(src/apis/vulkan/)
# target_link_libraries(Gryphn GryphnVulkanImpl)
# endif()

View File

@@ -3,11 +3,9 @@ set(CMAKE_CXX_STANDARD 17)
project(GryphnMetalImpl) project(GryphnMetalImpl)
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS
"src/*.cpp" "src/*.hpp" "src/*.c" "src/*.h" "src/*.m"
"src/*.c" "src/*.h"
"src/*.mm" "src/*.m"
) )
add_library(GryphnMetalImpl SHARED ${SOURCE_FILES}) add_library(GryphnMetalImpl STATIC ${SOURCE_FILES})
target_include_directories(GryphnMetalImpl PUBLIC target_include_directories(GryphnMetalImpl PUBLIC
${CMAKE_SOURCE_DIR}/gryphn/include/ ${CMAKE_SOURCE_DIR}/gryphn/include/
${CMAKE_SOURCE_DIR}/gryphn/src/ ${CMAKE_SOURCE_DIR}/gryphn/src/
@@ -15,7 +13,6 @@ target_include_directories(GryphnMetalImpl PUBLIC
src/ src/
depends/SPIRV-Cross/ depends/SPIRV-Cross/
) )
# target_link_options(GryphnMetalImpl PRIVATE -rdynamic)
add_compile_definitions(GN_REVEAL_IMPL) add_compile_definitions(GN_REVEAL_IMPL)
add_subdirectory(depends/SPIRV-Cross) add_subdirectory(depends/SPIRV-Cross)
@@ -29,8 +26,3 @@ target_link_libraries(GryphnMetalImpl
"-framework Metal" "-framework Metal"
"-framework QuartzCore" "-framework QuartzCore"
) )
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/gryphn/rendering_apis)
add_custom_command(TARGET GryphnMetalImpl POST_BUILD
COMMAND mv libGryphnMetalImpl.dylib ../../rendering_apis/GryphnMetalImpl.dylib
)

View File

@@ -3,7 +3,6 @@ set(CMAKE_CXX_STANDARD 17)
project(GryphnVulkanImpl) project(GryphnVulkanImpl)
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS
"src/*.cpp" "src/*.hpp"
"src/*.c" "src/*.h" "src/*.c" "src/*.h"
) )
@@ -14,12 +13,12 @@ if (APPLE)
endif() endif()
find_package(Vulkan REQUIRED) find_package(Vulkan REQUIRED)
add_library(GryphnVulkanImpl SHARED ${SOURCE_FILES} ${METAL_FILES}) add_library(GryphnVulkanImpl STATIC ${SOURCE_FILES} ${METAL_FILES})
target_include_directories(GryphnVulkanImpl PUBLIC target_include_directories(GryphnVulkanImpl PUBLIC
${Vulkan_INCLUDE_DIRS} ${Vulkan_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/../../include/ ${CMAKE_CURRENT_SOURCE_DIR}/../../../include/
${CMAKE_CURRENT_SOURCE_DIR}/../../src/ ${CMAKE_CURRENT_SOURCE_DIR}/../../
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/ ${CMAKE_CURRENT_SOURCE_DIR}/../../utils/
src/ src/
) )
add_compile_definitions(GN_REVEAL_IMPL) add_compile_definitions(GN_REVEAL_IMPL)
@@ -29,7 +28,6 @@ if(WIN32)
add_compile_definitions(GN_PLATFORM_WIN32) add_compile_definitions(GN_PLATFORM_WIN32)
endif() endif()
if(APPLE) if(APPLE)
target_link_libraries(GryphnVulkanImpl target_link_libraries(GryphnVulkanImpl
"-framework IOKit" "-framework IOKit"
"-framework CoreFoundation" "-framework CoreFoundation"
@@ -38,22 +36,8 @@ if(APPLE)
"-framework Metal" "-framework Metal"
"-framework QuartzCore" "-framework QuartzCore"
) )
add_compile_definitions(GN_PLATFORM_MACOS) add_compile_definitions(GN_PLATFORM_MACOS)
endif() endif()
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
add_compile_definitions(GN_PLATFORM_LINUX) add_compile_definitions(GN_PLATFORM_LINUX)
endif() endif()
if (APPLE)
add_custom_command(TARGET GryphnVulkanImpl POST_BUILD
COMMAND mv libGryphnVulkanImpl.dylib
${CMAKE_BINARY_DIR}/gryphn/rendering_apis/GryphnVulkanImpl.dylib
)
endif()
if (UNIX AND NOT APPLE)
add_custom_command(TARGET GryphnVulkanImpl POST_BUILD
COMMAND mv libGryphnVulkanImpl.so
${CMAKE_BINARY_DIR}/gryphn/rendering_apis/GryphnVulkanImpl.so
)
endif()

15
src/core/CMakeLists.txt Normal file
View File

@@ -0,0 +1,15 @@
set(CMAKE_EXPORT_COMPILE_COMMANDS on)
project(GryphnCore)
add_compile_definitions(GN_REVEAL_IMPL)
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS "src/*.c")
if(APPLE)
file(GLOB_RECURSE METAL_FILES CONFIGURE_DEPENDS "src/*.m")
endif()
add_library(GryphnCore ${SOURCE_FILES} ${METAL_FILES})
target_include_directories(GryphnCore PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
target_include_directories(GryphnCore PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/)
target_include_directories(GryphnCore PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include/)
target_include_directories(GryphnCore PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../utils)
target_include_directories(GryphnCore PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../utils)

View File

@@ -1,27 +0,0 @@
#include "gryphn_instance.h"
#include "init/gryphn_init.h"
#include <core/gryphn_platform_functions.h>
#include "core/instance/gryphn_instance.h"
#include "core/debugger/gryphn_debugger.h"
#include "core/gryphn_handles.h"
#include "stdio.h"
gnReturnCode gnCreateInstance(gnInstanceHandle* instanceHandlePtr, gnInstanceInfo info) {
*instanceHandlePtr = malloc(sizeof(struct gnInstance_t));
gnInstanceHandle instance = *instanceHandlePtr;
if (!gnIsAPISupported(info.renderingAPI)) return GN_UNSUPPORTED_RENDERING_API;
instance->loadDeviceFunctions = gnFalse;
instance->dynamicLib = gnLoadRenderingDLL(info.renderingAPI);
if (instance->dynamicLib == NULL) return GN_UNABLE_TO_LOAD_DYNAMIC_LIBARRY;
instance->functions = gnLoadFunctions(instance);
if (info.debugger)
instance->debugger = info.debugger;
instance->loadCommandFunctions = gnFalse;
instance->loadDeviceFunctions = gnFalse;
return instance->functions->_gnCreateInstance(instance, info);
}
void gnDestroyInstance(gnInstanceHandle instance) {
instance->functions->_gnDestroyInstance(instance);
}

View File

@@ -1,6 +1,6 @@
#include "gryphn_buffer.h" #include "gryphn_buffer.h"
#include "core/output_device/gryphn_output_device.h" #include "output_device/gryphn_output_device.h"
#include "core/gryphn_platform_functions.h" #include "gryphn_platform_functions.h"
gnReturnCode gnCreateBuffer(gnBufferHandle* buffer, gnOutputDeviceHandle device, gnBufferInfo info) { gnReturnCode gnCreateBuffer(gnBufferHandle* buffer, gnOutputDeviceHandle device, gnBufferInfo info) {
*buffer = malloc(sizeof(struct gnBuffer_t)); *buffer = malloc(sizeof(struct gnBuffer_t));

View File

@@ -2,7 +2,7 @@
#include "stdlib.h" #include "stdlib.h"
#include "utils/gryphn_error_code.h" #include "utils/gryphn_error_code.h"
#include "utils/lists/gryphn_array_list.h" #include "utils/lists/gryphn_array_list.h"
#include <core/gryphn_handles.h> #include <gryphn_handles.h>
typedef enum gnIndexType { typedef enum gnIndexType {
GN_UINT16, GN_UINT32 GN_UINT16, GN_UINT32

View File

@@ -1,5 +1,5 @@
#include "gryphn_command_buffer.h" #include "gryphn_command_buffer.h"
#include "core/gryphn_platform_functions.h" #include "gryphn_platform_functions.h"
gnReturnCode gnCommandPoolAllocateCommandBuffersFromPointer(gnCommandBufferHandle* buffers, uint32_t count, gnCommandPoolHandle commandPool) { gnReturnCode gnCommandPoolAllocateCommandBuffersFromPointer(gnCommandBufferHandle* buffers, uint32_t count, gnCommandPoolHandle commandPool) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {

View File

@@ -2,7 +2,7 @@
#include "stdint.h" #include "stdint.h"
#include "utils/gryphn_error_code.h" #include "utils/gryphn_error_code.h"
#include "utils/lists/gryphn_array_list.h" #include "utils/lists/gryphn_array_list.h"
#include "core/gryphn_handles.h" #include "gryphn_handles.h"
#ifdef GN_REVEAL_IMPL #ifdef GN_REVEAL_IMPL
struct gnCommandBuffer_t { struct gnCommandBuffer_t {

View File

@@ -1,6 +1,6 @@
#include "gryphn_command_pool.h" #include "gryphn_command_pool.h"
#include "core/gryphn_platform_functions.h" #include "gryphn_platform_functions.h"
#include "core/instance/init/gryphn_init.h" #include "instance/init/gryphn_init.h"
gnReturnCode gnCreateCommandPool(gnCommandPoolHandle* commandPool, gnOutputDeviceHandle device, struct gnCommandPoolInfo_t info) { gnReturnCode gnCreateCommandPool(gnCommandPoolHandle* commandPool, gnOutputDeviceHandle device, struct gnCommandPoolInfo_t info) {
*commandPool = malloc(sizeof(struct gnCommandPool_t)); *commandPool = malloc(sizeof(struct gnCommandPool_t));

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include "stdint.h" #include "stdint.h"
#include <utils/gryphn_error_code.h> #include <utils/gryphn_error_code.h>
#include "core/gryphn_handles.h" #include "gryphn_handles.h"
typedef struct gnCommandPoolInfo_t { typedef struct gnCommandPoolInfo_t {
uint32_t queueIndex; uint32_t queueIndex;

View File

@@ -1,7 +1,7 @@
#include "gryphn_command.h" #include "gryphn_command.h"
#include "core/command/command_buffer/gryphn_command_buffer.h" #include "command/command_buffer/gryphn_command_buffer.h"
#include "core/command/command_pool/gryphn_command_pool.h" #include "command/command_pool/gryphn_command_pool.h"
#include "core/gryphn_platform_functions.h" #include "gryphn_platform_functions.h"
void gnCommandBeginRenderPass(struct gnCommandBuffer_t* buffer, struct gnRenderPassInfo_t passInfo) { void gnCommandBeginRenderPass(struct gnCommandBuffer_t* buffer, struct gnRenderPassInfo_t passInfo) {
buffer->commandPool->commandFunctions->_gnCommandBeginRenderPass(buffer, passInfo); buffer->commandPool->commandFunctions->_gnCommandBeginRenderPass(buffer, passInfo);

View File

@@ -1,17 +1,17 @@
#include "core/gryphn_handles.h" #include "gryphn_handles.h"
#include "core/renderpass/gryphn_render_pass.h" #include "renderpass/gryphn_render_pass.h"
void gnCommandBeginRenderPass(gnCommandBufferHandle buffer, gnRenderPassInfo passInfo); void gnCommandBeginRenderPass(gnCommandBufferHandle buffer, gnRenderPassInfo passInfo);
void gnCommandEndRenderPass(gnCommandBufferHandle buffer); void gnCommandEndRenderPass(gnCommandBufferHandle buffer);
#include "core/pipelines/graphics_pipeline/gryphn_graphics_pipeline.h" #include "pipelines/graphics_pipeline/gryphn_graphics_pipeline.h"
void gnCommandBindGraphicsPipeline(gnCommandBufferHandle buffer, gnGraphicsPipelineHandle graphicsPipeline); void gnCommandBindGraphicsPipeline(gnCommandBufferHandle buffer, gnGraphicsPipelineHandle graphicsPipeline);
void gnCommandSetViewport(gnCommandBufferHandle buffer, gnViewport viewport); void gnCommandSetViewport(gnCommandBufferHandle buffer, gnViewport viewport);
void gnCommandSetScissor(gnCommandBufferHandle buffer, gnScissor scissor); void gnCommandSetScissor(gnCommandBufferHandle buffer, gnScissor scissor);
void gnCommandBindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set); void gnCommandBindUniform(gnCommandBufferHandle buffer, gnUniform uniform, uint32_t set);
void gnCommandPushConstant(gnCommandBufferHandle buffer, gnPushConstantLayout layout, void* data); void gnCommandPushConstant(gnCommandBufferHandle buffer, gnPushConstantLayout layout, void* data);
#include "core/buffers/gryphn_buffer.h" #include "buffers/gryphn_buffer.h"
void gnCommandBindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type); void gnCommandBindBuffer(gnCommandBufferHandle buffer, gnBufferHandle bufferToBind, gnBufferType type);
void gnCommandDraw(gnCommandBufferHandle buffer, int vertexCount, int firstVertex, int instanceCount, int firstInstance); void gnCommandDraw(gnCommandBufferHandle buffer, int vertexCount, int firstVertex, int instanceCount, int firstInstance);

View File

@@ -1,5 +1,5 @@
#include "gryphn_debugger.h" #include "gryphn_debugger.h"
#include <core/gryphn_platform_functions.h> #include <gryphn_platform_functions.h>
gnReturnCode gnCreateDebugger(gnDebuggerHandle* debugger, const gnDebuggerInfo info) { gnReturnCode gnCreateDebugger(gnDebuggerHandle* debugger, const gnDebuggerInfo info) {
*debugger = malloc(sizeof(struct gnDebugger_t)); *debugger = malloc(sizeof(struct gnDebugger_t));

View File

@@ -2,7 +2,7 @@
#include "stdint.h" #include "stdint.h"
#include "utils/gryphn_string.h" #include "utils/gryphn_string.h"
#include "utils/gryphn_error_code.h" #include "utils/gryphn_error_code.h"
#include "core/gryphn_handles.h" #include "gryphn_handles.h"
struct gnPlatformDebugger_t; struct gnPlatformDebugger_t;

View File

@@ -1,5 +1,5 @@
#include "gryphn_framebuffer.h" #include "gryphn_framebuffer.h"
#include "core/gryphn_platform_functions.h" #include "gryphn_platform_functions.h"
gnReturnCode gnCreateFramebuffer(gnFramebuffer* framebuffer, gnOutputDeviceHandle device, gnFramebufferInfo framebufferInfo) { gnReturnCode gnCreateFramebuffer(gnFramebuffer* framebuffer, gnOutputDeviceHandle device, gnFramebufferInfo framebufferInfo) {
*framebuffer = malloc(sizeof(struct gnFramebuffer_t)); *framebuffer = malloc(sizeof(struct gnFramebuffer_t));

Some files were not shown because too many files have changed in this diff Show More