remove FNA3D dependency

submit_rewrite
cosmonaut 2020-12-16 18:12:20 -08:00
parent 16d70b2ad8
commit f8621562f2
8 changed files with 17 additions and 56 deletions

2
.gitignore vendored
View File

@ -13,5 +13,5 @@ Release/
xcuserdata/
*.xcworkspace/
build/
CMakeCache.text
CMakeCache.txt
cmake.check_cache

View File

@ -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

View File

@ -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")

2
README
View File

@ -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

View File

@ -25,7 +25,6 @@
*/
#include <stddef.h>
#include <FNA3D.h>
#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. */

View File

@ -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)

View File

@ -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;

View File

@ -35,10 +35,10 @@
#include <SDL_syswm.h>
#include <SDL_vulkan.h>
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;
}