From f8621562f2b76e118cd7d32196003fabb6b99771 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Wed, 16 Dec 2020 18:12:20 -0800 Subject: [PATCH] remove FNA3D dependency --- .gitignore | 2 +- CMakeCache.txt | 38 ------------------------------------- CMakeLists.txt | 2 -- README | 2 +- include/Refresh.h | 7 ++++--- src/Refresh.c | 4 ++-- src/Refresh_Driver.h | 5 ++--- src/Refresh_Driver_Vulkan.c | 13 +++++++------ 8 files changed, 17 insertions(+), 56 deletions(-) delete mode 100644 CMakeCache.txt diff --git a/.gitignore b/.gitignore index cec6002..aec2911 100644 --- a/.gitignore +++ b/.gitignore @@ -13,5 +13,5 @@ Release/ xcuserdata/ *.xcworkspace/ build/ -CMakeCache.text +CMakeCache.txt cmake.check_cache diff --git a/CMakeCache.txt b/CMakeCache.txt deleted file mode 100644 index a0b2a45..0000000 --- a/CMakeCache.txt +++ /dev/null @@ -1,38 +0,0 @@ -# This is the CMakeCache file. -# For build in directory: /home/cosmonaut/programming/Refresh -# It was generated by CMake: /usr/bin/cmake -# You can edit this file to change values found and used by cmake. -# If you do not want to change any of the values, simply exit the editor. -# If you do want to change a value, simply edit, save, and exit the editor. -# The syntax for the file is as follows: -# KEY:TYPE=VALUE -# KEY is the name of a variable in the cache. -# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. -# VALUE is the current value for the KEY. - -######################## -# EXTERNAL cache entries -######################## - - -######################## -# INTERNAL cache entries -######################## - -//This is the directory where this CMakeCache.txt was created -CMAKE_CACHEFILE_DIR:INTERNAL=/home/cosmonaut/programming/Refresh -//Major version of cmake used to create the current loaded cache -CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 -//Minor version of cmake used to create the current loaded cache -CMAKE_CACHE_MINOR_VERSION:INTERNAL=18 -//Patch version of cmake used to create the current loaded cache -CMAKE_CACHE_PATCH_VERSION:INTERNAL=4 -//Path to CMake executable. -CMAKE_COMMAND:INTERNAL=/usr/bin/cmake -//Path to cpack program executable. -CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack -//Path to ctest program executable. -CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest -//Path to CMake installation. -CMAKE_ROOT:INTERNAL=/usr/share/cmake - diff --git a/CMakeLists.txt b/CMakeLists.txt index f143366..4ea719c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,8 +76,6 @@ set_target_properties(Refresh PROPERTIES OUTPUT_NAME "Refresh" SOVERSION ${LIB_MAJOR_VERSION} ) -target_include_directories(Refresh PUBLIC ../FNA3D/include) - # SDL2 Dependency if (DEFINED SDL2_INCLUDE_DIRS AND DEFINED SDL2_LIBRARIES) message(STATUS "using pre-defined SDL2 variables SDL2_INCLUDE_DIRS and SDL2_LIBRARIES") diff --git a/README b/README index 43a97a7..e409ddd 100644 --- a/README +++ b/README @@ -14,7 +14,7 @@ For shaders, we plan to consume SPIR-V bytecode. Dependencies ------------ -Refresh depends on SDL2. It also depends on FNA3D to ease interoperability in FNA. +Refresh depends on SDL2 for portability. Refresh never explicitly uses the C runtime. Building Refresh diff --git a/include/Refresh.h b/include/Refresh.h index 829c82b..6721d2d 100644 --- a/include/Refresh.h +++ b/include/Refresh.h @@ -25,7 +25,6 @@ */ #include -#include #ifndef REFRESH_H #define REFRESH_H @@ -586,10 +585,12 @@ REFRESHAPI uint32_t REFRESH_LinkedVersion(void); * This creation method takes an existing FNA3D_Device * to ease interoperability with existing FNA graphics code. * - * fnaDevice: An allocated FNA3D_Device structure. + * deviceWindowHandle: + * A handle to an SDL_Window. + * If this is NULL, Refresh will attempt to run in headless mode. */ REFRESHAPI REFRESH_Device* REFRESH_CreateDevice( - FNA3D_Device *fnaDevice + void *deviceWindowHandle ); /* Destroys a rendering context previously returned by REFRESH_CreateDevice. */ diff --git a/src/Refresh.c b/src/Refresh.c index 0a04e43..443dc26 100644 --- a/src/Refresh.c +++ b/src/Refresh.c @@ -49,14 +49,14 @@ uint32_t REFRESH_LinkedVersion(void) static int32_t selectedDriver = -1; REFRESH_Device* REFRESH_CreateDevice( - FNA3D_Device *fnaDevice + void *deviceWindowHandle ) { if (selectedDriver < 0) { return NULL; } - return drivers[selectedDriver]->CreateDevice(fnaDevice); + return drivers[selectedDriver]->CreateDevice(deviceWindowHandle); } void REFRESH_DestroyDevice(REFRESH_Device *device) diff --git a/src/Refresh_Driver.h b/src/Refresh_Driver.h index 1de23dd..00b603b 100644 --- a/src/Refresh_Driver.h +++ b/src/Refresh_Driver.h @@ -56,7 +56,6 @@ static inline uint32_t Texture_GetFormatSize( return 2; case REFRESH_SURFACEFORMAT_R8G8B8A8: case REFRESH_SURFACEFORMAT_R32_SFLOAT: - case FNA3D_SURFACEFORMAT_RG32: case REFRESH_SURFACEFORMAT_R16G16_SFLOAT: case REFRESH_SURFACEFORMAT_R8G8B8A8_SNORM: case REFRESH_SURFACEFORMAT_A2R10G10B10: @@ -101,7 +100,7 @@ static inline uint32_t PrimitiveVerts( static inline uint32_t IndexSize(REFRESH_IndexElementSize size) { - return (size == FNA3D_INDEXELEMENTSIZE_16BIT) ? 2 : 4; + return (size == REFRESH_INDEXELEMENTSIZE_16BIT) ? 2 : 4; } static inline uint32_t BytesPerRow( @@ -540,7 +539,7 @@ typedef struct REFRESH_Driver { const char *Name; REFRESH_Device* (*CreateDevice)( - FNA3D_Device *fnaDevice + void *deviceWindowHandle ); } REFRESH_Driver; diff --git a/src/Refresh_Driver_Vulkan.c b/src/Refresh_Driver_Vulkan.c index 93c589d..3a0a242 100644 --- a/src/Refresh_Driver_Vulkan.c +++ b/src/Refresh_Driver_Vulkan.c @@ -35,10 +35,10 @@ #include #include -typedef struct VulkanRenderer +typedef struct Refresh_VulkanRenderer { - FNA3D_Device *device; -} VulkanRenderer; + VkInstance instance; +} Refresh_VulkanRenderer; static void VULKAN_DestroyDevice( REFRESH_Device *device @@ -445,15 +445,16 @@ static void VULKAN_BindGraphicsPipeline( } static REFRESH_Device* VULKAN_CreateDevice( - FNA3D_Device *fnaDevice + void *deviceWindowHandle ) { REFRESH_Device *result; - VulkanRenderer *renderer; + Refresh_VulkanRenderer *renderer; result = (REFRESH_Device*) SDL_malloc(sizeof(REFRESH_Device)); ASSIGN_DRIVER(VULKAN) - renderer = (VulkanRenderer*) SDL_malloc(sizeof(VulkanRenderer)); + renderer = (Refresh_VulkanRenderer*) SDL_malloc(sizeof(Refresh_VulkanRenderer)); + result->driverData = (REFRESH_Renderer*) renderer; return result; }