Merge branch 'r/meson_refactor'
This commit is contained in:
		
						commit
						058c738da9
					
				
							
								
								
									
										181
									
								
								meson.build
									
									
									
									
									
								
							
							
						
						
									
										181
									
								
								meson.build
									
									
									
									
									
								
							@ -46,8 +46,6 @@ if buildtype == 'debug' or buildtype == 'debugoptimized'
 | 
				
			|||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Gather dependencies
 | 
					# Gather dependencies
 | 
				
			||||||
common_incdirs = [include_directories(['contrib', 'src'])]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
thread_dep = dependency('threads')
 | 
					thread_dep = dependency('threads')
 | 
				
			||||||
m_dep = compiler.find_library('m', required : false)
 | 
					m_dep = compiler.find_library('m', required : false)
 | 
				
			||||||
vk_dep = dependency('vulkan', required : false)
 | 
					vk_dep = dependency('vulkan', required : false)
 | 
				
			||||||
@ -61,172 +59,35 @@ endif
 | 
				
			|||||||
# Copy file utility
 | 
					# Copy file utility
 | 
				
			||||||
copy_util = find_program('scripts/copy_util.py')
 | 
					copy_util = find_program('scripts/copy_util.py')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
runtime_incdirs = common_incdirs
 | 
					engine_incdir = include_directories('src')
 | 
				
			||||||
runtime_linkargs = []
 | 
					 | 
				
			||||||
runtime_additional_sources = []
 | 
					 | 
				
			||||||
runtime_cargs = []
 | 
					 | 
				
			||||||
runtime_deps = [thread_dep, m_dep, windowing_dep]
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
if get_option('build_asset_compiler')
 | 
					contrib_dir = meson.project_source_root() / 'contrib'
 | 
				
			||||||
  runtime_cargs += ['-DRT_BUILD_ASSET_COMPILER']
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # DXC for vulkan & directx shaders
 | 
					 | 
				
			||||||
  if get_option('enable_dxc_shader_compiler')
 | 
					 | 
				
			||||||
    # We package dxc binaries under contrib/dxc
 | 
					 | 
				
			||||||
    dxc_include = include_directories('contrib' / 'dxc' / 'inc')
 | 
					 | 
				
			||||||
    dxc_libdir = 'NONE'
 | 
					 | 
				
			||||||
    if host_machine.system() == 'windows'
 | 
					 | 
				
			||||||
        dxc_libdir = meson.project_source_root() / 'contrib' / 'dxc' / 'lib' / 'x64'
 | 
					 | 
				
			||||||
        custom_target('copy dxcompiler.dll',
 | 
					 | 
				
			||||||
            input : 'contrib' / 'dxc' / 'bin' / 'x64' / 'dxcompiler.dll',
 | 
					 | 
				
			||||||
            output : 'dxcompiler.dll',
 | 
					 | 
				
			||||||
            command : [copy_util, '@INPUT@', '@OUTPUT@'],
 | 
					 | 
				
			||||||
            install : false,
 | 
					 | 
				
			||||||
            build_by_default : true)
 | 
					 | 
				
			||||||
    endif
 | 
					 | 
				
			||||||
    dxc_dep = declare_dependency(link_args : ['-L'+dxc_libdir, '-ldxcompiler'], include_directories : dxc_include)
 | 
					 | 
				
			||||||
    runtime_deps += dxc_dep
 | 
					 | 
				
			||||||
    runtime_additional_sources += [
 | 
					 | 
				
			||||||
        'src/runtime/dxc_shader_compiler.cpp'
 | 
					 | 
				
			||||||
    ]
 | 
					 | 
				
			||||||
    runtime_cargs += ['-DRT_BUILD_DXC_SHADER_COMPILER']
 | 
					 | 
				
			||||||
  endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # Asset compiler sources
 | 
					 | 
				
			||||||
  runtime_additional_sources += [
 | 
					 | 
				
			||||||
    'src/runtime/asset_compiler.h',
 | 
					 | 
				
			||||||
    'src/runtime/description_parser.h',
 | 
					 | 
				
			||||||
    'src/runtime/shader_compiler.h',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    'src/runtime/asset_compiler.c',
 | 
					 | 
				
			||||||
    'src/runtime/description_parser.c',
 | 
					 | 
				
			||||||
    'src/runtime/framegraph_processor.c',
 | 
					 | 
				
			||||||
    'src/runtime/pipeline_processor.c',
 | 
					 | 
				
			||||||
    'src/runtime/shader_compiler.c',
 | 
					 | 
				
			||||||
  ]
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
runtime_lib = library('rt',
 | 
					 | 
				
			||||||
  # Project Sources
 | 
					 | 
				
			||||||
  'src/runtime/aio.h',
 | 
					 | 
				
			||||||
  'src/runtime/app.h',
 | 
					 | 
				
			||||||
  'src/runtime/buffer_manager.h',
 | 
					 | 
				
			||||||
  'src/runtime/compression.h',
 | 
					 | 
				
			||||||
  'src/runtime/config.h',
 | 
					 | 
				
			||||||
  'src/runtime/ds.h',
 | 
					 | 
				
			||||||
  'src/runtime/dynamic_libs.h',
 | 
					 | 
				
			||||||
  'src/runtime/file_tab.h',
 | 
					 | 
				
			||||||
  'src/runtime/fsutils.h',
 | 
					 | 
				
			||||||
  'src/runtime/gfx.h',
 | 
					 | 
				
			||||||
  'src/runtime/handles.h',
 | 
					 | 
				
			||||||
  'src/runtime/hashing.h',
 | 
					 | 
				
			||||||
  'src/runtime/jobs.h',
 | 
					 | 
				
			||||||
  'src/runtime/mem_arena.h',
 | 
					 | 
				
			||||||
  'src/runtime/renderer_api.h',
 | 
					 | 
				
			||||||
  'src/runtime/resources.h',
 | 
					 | 
				
			||||||
  'src/runtime/runtime.h',
 | 
					 | 
				
			||||||
  'src/runtime/threading.h',
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  'src/runtime/aio.c',
 | 
					 | 
				
			||||||
  'src/runtime/app.c',
 | 
					 | 
				
			||||||
  'src/runtime/assert.c',
 | 
					 | 
				
			||||||
  'src/runtime/buffer_manager.c',
 | 
					 | 
				
			||||||
  'src/runtime/compression.c',
 | 
					 | 
				
			||||||
  'src/runtime/config.c',
 | 
					 | 
				
			||||||
  'src/runtime/ds_minheap.c',
 | 
					 | 
				
			||||||
  'src/runtime/dynamic_libs.c',
 | 
					 | 
				
			||||||
  'src/runtime/error_report.c',
 | 
					 | 
				
			||||||
  'src/runtime/file_tab.c',
 | 
					 | 
				
			||||||
  'src/runtime/fsutils.c',
 | 
					 | 
				
			||||||
  'src/runtime/gfx_framegraph.c',
 | 
					 | 
				
			||||||
  'src/runtime/gfx_main.c',
 | 
					 | 
				
			||||||
  'src/runtime/hashing.c',
 | 
					 | 
				
			||||||
  'src/runtime/init.c',
 | 
					 | 
				
			||||||
  'src/runtime/jobs.c',
 | 
					 | 
				
			||||||
  'src/runtime/mem_arena.c',
 | 
					 | 
				
			||||||
  'src/runtime/resource_manager.c',
 | 
					 | 
				
			||||||
  'src/runtime/sprint.c',
 | 
					 | 
				
			||||||
  'src/runtime/text.c',
 | 
					 | 
				
			||||||
  'src/runtime/threading_cond.c',
 | 
					 | 
				
			||||||
  'src/runtime/threading_mutex.c',
 | 
					 | 
				
			||||||
  'src/runtime/threading_rwlock.c',
 | 
					 | 
				
			||||||
  'src/runtime/threading_thread.c',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # Contrib Sources
 | 
					 | 
				
			||||||
  'contrib/xxhash/xxhash.c',
 | 
					 | 
				
			||||||
  'contrib/lz4/lz4.c',
 | 
					 | 
				
			||||||
  sources : runtime_additional_sources,
 | 
					 | 
				
			||||||
  dependencies : runtime_deps,
 | 
					 | 
				
			||||||
  include_directories : runtime_incdirs,
 | 
					 | 
				
			||||||
  link_args : runtime_linkargs,
 | 
					 | 
				
			||||||
  c_args : runtime_cargs,
 | 
					 | 
				
			||||||
  c_pch : 'pch/rt_pch.h',
 | 
					 | 
				
			||||||
  cpp_args : runtime_cargs,
 | 
					 | 
				
			||||||
  cpp_pch : 'pch/rt_pch.h')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Renderer libraries
 | 
					 | 
				
			||||||
static_renderer_lib = 'NONE'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if vk_dep.found()
 | 
					 | 
				
			||||||
  platform_defs = []
 | 
					 | 
				
			||||||
  if get_option('use_xlib')
 | 
					 | 
				
			||||||
    platform_defs = ['-DVK_USE_PLATFORM_XLIB_KHR']
 | 
					 | 
				
			||||||
  elif host_machine.system() == 'windows'
 | 
					 | 
				
			||||||
    platform_defs = ['-DVK_USE_PLATFORM_WIN32_KHR']
 | 
					 | 
				
			||||||
  endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  vk_inc_dep = vk_dep.partial_dependency(compile_args : true, includes : true)
 | 
					 | 
				
			||||||
  vk_renderer_lib = library('rtvk',
 | 
					 | 
				
			||||||
    # Project Sources
 | 
					 | 
				
			||||||
    'src/renderer/vk/gpu.h',
 | 
					 | 
				
			||||||
    'src/renderer/vk/pipelines.h',
 | 
					 | 
				
			||||||
    'src/renderer/vk/render_targets.h',
 | 
					 | 
				
			||||||
    'src/renderer/vk/swapchain.h',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    'src/renderer/vk/helper.c',
 | 
					 | 
				
			||||||
    'src/renderer/vk/init.c',
 | 
					 | 
				
			||||||
    'src/renderer/vk/pipelines.c',
 | 
					 | 
				
			||||||
    'src/renderer/vk/render_targets.c',
 | 
					 | 
				
			||||||
    'src/renderer/vk/swapchain.c',
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Contrib Sources
 | 
					 | 
				
			||||||
    'contrib/volk/volk.h',
 | 
					 | 
				
			||||||
    'contrib/volk/volk.c',
 | 
					 | 
				
			||||||
    'contrib/vma/vk_mem_alloc.h',
 | 
					 | 
				
			||||||
    'src/renderer/vk/vma_impl.cpp',
 | 
					 | 
				
			||||||
    dependencies : [m_dep, vk_inc_dep, windowing_dep],
 | 
					 | 
				
			||||||
    include_directories : common_incdirs,
 | 
					 | 
				
			||||||
    link_with : [runtime_lib],
 | 
					 | 
				
			||||||
    c_pch : 'pch/vk_pch.h',
 | 
					 | 
				
			||||||
    c_args : platform_defs,
 | 
					 | 
				
			||||||
    cpp_pch : 'pch/vk_pch.h',
 | 
					 | 
				
			||||||
    cpp_args : platform_defs)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  static_renderer_lib = vk_renderer_lib
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					subdir('src')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Handle linking against both runtime and renderer if we build static libs
 | 
					# Handle linking against both runtime and renderer if we build static libs
 | 
				
			||||||
engine_link_libs = []
 | 
					engine_link_libs = []
 | 
				
			||||||
if get_option('default_library') == 'static'
 | 
					if get_option('default_library') == 'static'
 | 
				
			||||||
  engine_link_libs = [runtime_lib, static_renderer_lib]
 | 
					  if get_option('static_renderer') == 'vk'
 | 
				
			||||||
 | 
					    engine_link_libs = [runtime_lib, vk_renderer_lib]
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    error('Invalid static_renderer option ', get_option('static_renderer'))
 | 
				
			||||||
 | 
					  endif
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
  engine_link_libs = [runtime_lib]
 | 
					  engine_link_libs = [runtime_lib]
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Game
 | 
					# Unit/Integration test driver
 | 
				
			||||||
executable('voyage',
 | 
					subdir('tests')
 | 
				
			||||||
  'src/game/entry.c',
 | 
					 | 
				
			||||||
  'src/game/main.c',
 | 
					 | 
				
			||||||
  include_directories : common_incdirs,
 | 
					 | 
				
			||||||
  link_with : engine_link_libs,
 | 
					 | 
				
			||||||
  win_subsystem : 'windows')
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Unit Tests
 | 
					# Declare dependencies, to enable using the engine as a subproject
 | 
				
			||||||
rttest_exe = executable('rttest',
 | 
					engine_dep = declare_dependency(link_with : engine_link_libs,
 | 
				
			||||||
  'src/tests/rttest.c',
 | 
					  include_directories : engine_incdir)
 | 
				
			||||||
  link_with : engine_link_libs,
 | 
					
 | 
				
			||||||
  include_directories : common_incdirs,
 | 
					assetc_dep = declare_dependency(link_with : asset_compiler,
 | 
				
			||||||
  win_subsystem : 'console')
 | 
					  include_directories : engine_incdir)
 | 
				
			||||||
test('runtime test', rttest_exe)
 | 
					
 | 
				
			||||||
 | 
					# "inline" game
 | 
				
			||||||
 | 
					if get_option('game_as_subdir')
 | 
				
			||||||
 | 
					  subdir('src/game')
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,5 @@
 | 
				
			|||||||
 | 
					option('static_renderer', type : 'string', value : 'vk', description : 'Name of the renderer used for static builds')
 | 
				
			||||||
option('use_xlib', type : 'boolean', value : false, description : 'Use Xlib for window creation under linux')
 | 
					option('use_xlib', type : 'boolean', value : false, description : 'Use Xlib for window creation under linux')
 | 
				
			||||||
option('error_report_debugbreak', type : 'boolean', value : true, description : 'Debugbreak in ReportError')
 | 
					option('error_report_debugbreak', type : 'boolean', value : true, description : 'Debugbreak in ReportError')
 | 
				
			||||||
option('build_asset_compiler', type : 'boolean', value : true, description : 'Enables or disables the asset compiler inside runtime.')
 | 
					 | 
				
			||||||
option('enable_dxc_shader_compiler', type : 'boolean', value : true, description : 'Enables building the dxc-based shader compiler.')
 | 
					option('enable_dxc_shader_compiler', type : 'boolean', value : true, description : 'Enables building the dxc-based shader compiler.')
 | 
				
			||||||
 | 
					option('game_as_subdir', type : 'boolean', value : false, description : 'If true, adds the directory "src/game" to the build.')
 | 
				
			||||||
 | 
				
			|||||||
@ -1,22 +1,21 @@
 | 
				
			|||||||
#include "asset_compiler.h"
 | 
					#include "asset_compiler.h"
 | 
				
			||||||
#include "buffer_manager.h"
 | 
					#include "processor.h"
 | 
				
			||||||
#include "config.h"
 | 
					
 | 
				
			||||||
#include "file_tab.h"
 | 
					#include "runtime/aio.h"
 | 
				
			||||||
#include "fsutils.h"
 | 
					#include "runtime/buffer_manager.h"
 | 
				
			||||||
#include "mem_arena.h"
 | 
					#include "runtime/config.h"
 | 
				
			||||||
#include "resources.h"
 | 
					#include "runtime/file_tab.h"
 | 
				
			||||||
#include "runtime.h"
 | 
					#include "runtime/fsutils.h"
 | 
				
			||||||
#include "threading.h"
 | 
					#include "runtime/mem_arena.h"
 | 
				
			||||||
 | 
					#include "runtime/resources.h"
 | 
				
			||||||
 | 
					#include "runtime/runtime.h"
 | 
				
			||||||
 | 
					#include "runtime/threading.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <assert.h>
 | 
					#include <assert.h>
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef RT_BUILD_ASSET_COMPILER
 | 
					 | 
				
			||||||
#error This should only be built when RT_BUILD_ASSET_COMPILER is defined.
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
    uint64_t last_processed;
 | 
					    uint64_t last_processed;
 | 
				
			||||||
    rt_resource_id resources[RT_MAX_RESOURCES_PER_ASSET];
 | 
					    rt_resource_id resources[RT_MAX_RESOURCES_PER_ASSET];
 | 
				
			||||||
@ -75,7 +74,15 @@ static rt_asset_processor _processors[] = {
 | 
				
			|||||||
static void ProcessorThreadEntry(void *);
 | 
					static void ProcessorThreadEntry(void *);
 | 
				
			||||||
static void CompilerThreadEntry(void *);
 | 
					static void CompilerThreadEntry(void *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
rt_result InitAssetCompiler(void) {
 | 
					
 | 
				
			||||||
 | 
					RT_DLLEXPORT void rtRegisterAssetCompilerCVars(void) {
 | 
				
			||||||
 | 
					    rtRegisterCVAR(&rt_AssetDirectory);
 | 
				
			||||||
 | 
					    rtRegisterCVAR(&rt_AssetDBSize);
 | 
				
			||||||
 | 
					    rtRegisterCVAR(&rt_AssetProcessingThreads);
 | 
				
			||||||
 | 
					    rtRegisterCVAR(&rt_AssetProcessorArenaSize);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RT_DLLEXPORT rt_result rtInitAssetCompiler(void) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    unsigned int db_size = (unsigned int)rt_AssetDBSize.i;
 | 
					    unsigned int db_size = (unsigned int)rt_AssetDBSize.i;
 | 
				
			||||||
    void *mem            = malloc((sizeof(rt_file_id) + sizeof(rt_asset_data)) * db_size);
 | 
					    void *mem            = malloc((sizeof(rt_file_id) + sizeof(rt_asset_data)) * db_size);
 | 
				
			||||||
@ -125,7 +132,7 @@ rt_result InitAssetCompiler(void) {
 | 
				
			|||||||
    return RT_SUCCESS;
 | 
					    return RT_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ShutdownAssetCompiler(void) {
 | 
					RT_DLLEXPORT void rtShutdownAssetCompiler(void) {
 | 
				
			||||||
    _keep_running = false;
 | 
					    _keep_running = false;
 | 
				
			||||||
    rtJoinThread(_compiler_thread);
 | 
					    rtJoinThread(_compiler_thread);
 | 
				
			||||||
    for (int i = 0; i < rt_AssetProcessingThreads.i; ++i)
 | 
					    for (int i = 0; i < rt_AssetProcessingThreads.i; ++i)
 | 
				
			||||||
@ -384,8 +391,6 @@ static void ProcessorThreadEntry(void *param) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* Utilities for asset processors*/
 | 
					/* Utilities for asset processors*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "aio.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
rt_loaded_asset LoadAsset(rt_file_id file) {
 | 
					rt_loaded_asset LoadAsset(rt_file_id file) {
 | 
				
			||||||
    const char *path = rtGetFilePath(file);
 | 
					    const char *path = rtGetFilePath(file);
 | 
				
			||||||
    size_t file_size = rtGetFileSize(path);
 | 
					    size_t file_size = rtGetFileSize(path);
 | 
				
			||||||
							
								
								
									
										22
									
								
								src/asset_compiler/asset_compiler.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/asset_compiler/asset_compiler.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					#ifndef RT_ASSET_PROCESSOR_H
 | 
				
			||||||
 | 
					#define RT_ASSET_PROCESSOR_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Public header for the asset processor */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "runtime/runtime.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
					extern "C" {
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RT_DLLEXPORT void rtRegisterAssetCompilerCVars(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RT_DLLEXPORT rt_result rtInitAssetCompiler(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RT_DLLEXPORT void rtShutdownAssetCompiler(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __cplusplus
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
@ -1,6 +1,7 @@
 | 
				
			|||||||
#include "description_parser.h"
 | 
					#include "description_parser.h"
 | 
				
			||||||
#include "runtime.h"
 | 
					
 | 
				
			||||||
#include "mem_arena.h"
 | 
					#include "runtime/runtime.h"
 | 
				
			||||||
 | 
					#include "runtime/mem_arena.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdbool.h>
 | 
					#include <stdbool.h>
 | 
				
			||||||
#include <limits.h>
 | 
					#include <limits.h>
 | 
				
			||||||
@ -4,7 +4,7 @@
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
#include <dxcapi.h>
 | 
					#include <dxcapi.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "asset_compiler.h"
 | 
					#include "processor.h"
 | 
				
			||||||
#include "shader_compiler.h"
 | 
					#include "shader_compiler.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern "C" rt_shader_bytecode CompileVulkanShader(rt_shader_stage stage,
 | 
					extern "C" rt_shader_bytecode CompileVulkanShader(rt_shader_stage stage,
 | 
				
			||||||
@ -1,7 +1,8 @@
 | 
				
			|||||||
#include "asset_compiler.h"
 | 
					#include "processor.h"
 | 
				
			||||||
#include "buffer_manager.h"
 | 
					 | 
				
			||||||
#include "description_parser.h"
 | 
					#include "description_parser.h"
 | 
				
			||||||
#include "gfx.h"
 | 
					
 | 
				
			||||||
 | 
					#include "runtime/buffer_manager.h"
 | 
				
			||||||
 | 
					#include "runtime/gfx.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
							
								
								
									
										44
									
								
								src/asset_compiler/meson.build
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								src/asset_compiler/meson.build
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,44 @@
 | 
				
			|||||||
 | 
					# Asset Compiler 
 | 
				
			||||||
 | 
					ac_deps = []
 | 
				
			||||||
 | 
					ac_sources = []
 | 
				
			||||||
 | 
					ac_cargs = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# DXC for vulkan & directx shaders
 | 
				
			||||||
 | 
					if get_option('enable_dxc_shader_compiler')
 | 
				
			||||||
 | 
					  # We package dxc binaries under contrib/dxc
 | 
				
			||||||
 | 
					  dxc_include = include_directories(meson.project_source_root() / 'contrib' / 'dxc' / 'inc')
 | 
				
			||||||
 | 
					  dxc_libdir = 'NONE'
 | 
				
			||||||
 | 
					  if host_machine.system() == 'windows'
 | 
				
			||||||
 | 
					    dxc_libdir = meson.project_source_root() / 'contrib' / 'dxc' / 'lib' / 'x64'
 | 
				
			||||||
 | 
					    custom_target('copy dxcompiler.dll',
 | 
				
			||||||
 | 
					      input : meson.project_source_root() / 'contrib' / 'dxc' / 'bin' / 'x64' / 'dxcompiler.dll',
 | 
				
			||||||
 | 
					      output : 'dxcompiler.dll',
 | 
				
			||||||
 | 
					      command : [copy_util, '@INPUT@', '@OUTPUT@'],
 | 
				
			||||||
 | 
					      install : false,
 | 
				
			||||||
 | 
					      build_by_default : true)
 | 
				
			||||||
 | 
					  endif
 | 
				
			||||||
 | 
					  dxc_dep = declare_dependency(link_args : ['-L'+dxc_libdir, '-ldxcompiler'], include_directories : dxc_include)
 | 
				
			||||||
 | 
					  ac_deps += dxc_dep
 | 
				
			||||||
 | 
					  ac_sources += [
 | 
				
			||||||
 | 
					    'dxc_shader_compiler.cpp'
 | 
				
			||||||
 | 
					  ]
 | 
				
			||||||
 | 
					  ac_cargs += '-DRT_BUILD_DXC_SHADER_COMPILER'
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					asset_compiler = static_library('asset_compiler',
 | 
				
			||||||
 | 
					  'asset_compiler.h',
 | 
				
			||||||
 | 
					  'description_parser.h',
 | 
				
			||||||
 | 
					  'processor.h',
 | 
				
			||||||
 | 
					  'shader_compiler.h',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  'asset_compiler.c',
 | 
				
			||||||
 | 
					  'description_parser.c',
 | 
				
			||||||
 | 
					  'framegraph_processor.c',
 | 
				
			||||||
 | 
					  'pipeline_processor.c',
 | 
				
			||||||
 | 
					  'shader_compiler.c',
 | 
				
			||||||
 | 
					  sources : ac_sources,
 | 
				
			||||||
 | 
					  include_directories : engine_incdir,
 | 
				
			||||||
 | 
					  link_with : runtime_lib,
 | 
				
			||||||
 | 
					  c_args : ac_cargs,
 | 
				
			||||||
 | 
					  cpp_args : ac_cargs,
 | 
				
			||||||
 | 
					  dependencies : ac_deps)
 | 
				
			||||||
@ -1,12 +1,13 @@
 | 
				
			|||||||
#include "asset_compiler.h"
 | 
					#include "processor.h"
 | 
				
			||||||
#include "buffer_manager.h"
 | 
					 | 
				
			||||||
#include "config.h"
 | 
					 | 
				
			||||||
#include "description_parser.h"
 | 
					#include "description_parser.h"
 | 
				
			||||||
#include "gfx.h"
 | 
					 | 
				
			||||||
#include "mem_arena.h"
 | 
					 | 
				
			||||||
#include "runtime.h"
 | 
					 | 
				
			||||||
#include "shader_compiler.h"
 | 
					#include "shader_compiler.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "runtime/buffer_manager.h"
 | 
				
			||||||
 | 
					#include "runtime/config.h"
 | 
				
			||||||
 | 
					#include "runtime/gfx.h"
 | 
				
			||||||
 | 
					#include "runtime/mem_arena.h"
 | 
				
			||||||
 | 
					#include "runtime/runtime.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <assert.h>
 | 
					#include <assert.h>
 | 
				
			||||||
#include <limits.h>
 | 
					#include <limits.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
@ -1,13 +1,9 @@
 | 
				
			|||||||
#ifndef RT_ASSET_COMPILER_H
 | 
					#ifndef RT_PROCESSOR_H
 | 
				
			||||||
#define RT_ASSET_COMPILER_H
 | 
					#define RT_PROCESSOR_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef RT_BUILD_ASSET_COMPILER
 | 
					#include "runtime/file_tab.h"
 | 
				
			||||||
#error This file should only be included if RT_BUILD_ASSET_COMPILER is defined.
 | 
					#include "runtime/mem_arena.h"
 | 
				
			||||||
#endif
 | 
					#include "runtime/resources.h"
 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "file_tab.h"
 | 
					 | 
				
			||||||
#include "resources.h"
 | 
					 | 
				
			||||||
#include "mem_arena.h"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
@ -1,10 +1,9 @@
 | 
				
			|||||||
#ifndef RT_SHADER_COMPILER_H
 | 
					#ifndef RT_SHADER_COMPILER_H
 | 
				
			||||||
#define RT_SHADER_COMPILER_H
 | 
					#define RT_SHADER_COMPILER_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "mem_arena.h"
 | 
					#include "runtime/runtime.h"
 | 
				
			||||||
#include "runtime.h"
 | 
					#include "runtime/mem_arena.h"
 | 
				
			||||||
 | 
					#include "runtime/renderer_api.h"
 | 
				
			||||||
#include "renderer_api.h"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
@ -2,12 +2,20 @@
 | 
				
			|||||||
#include "runtime/resources.h"
 | 
					#include "runtime/resources.h"
 | 
				
			||||||
#include "runtime/mem_arena.h"
 | 
					#include "runtime/mem_arena.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "asset_compiler/asset_compiler.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static rt_framegraph *_framegraph;
 | 
					static rt_framegraph *_framegraph;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void RegisterCVars(void) {
 | 
				
			||||||
 | 
					    rtRegisterAssetCompilerCVars();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Called after the runtime has finished its initialization and before entering the main-loop*/
 | 
					/* Called after the runtime has finished its initialization and before entering the main-loop*/
 | 
				
			||||||
void Init(void) {
 | 
					void Init(void) {
 | 
				
			||||||
    rtLog("GAME", "Init");
 | 
					    rtLog("GAME", "Init");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    rtInitAssetCompiler();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #if 0
 | 
					    #if 0
 | 
				
			||||||
    rt_render_target_id rt_ids[4] = {rtCalculateRenderTargetID("rt0", sizeof("rt0")),
 | 
					    rt_render_target_id rt_ids[4] = {rtCalculateRenderTargetID("rt0", sizeof("rt0")),
 | 
				
			||||||
                                     rtCalculateRenderTargetID("rt1", sizeof("rt1")),
 | 
					                                     rtCalculateRenderTargetID("rt1", sizeof("rt1")),
 | 
				
			||||||
@ -61,6 +69,8 @@ void Init(void) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    rt_resource_id id  = rtGetResourceID("assets/test.framegraph");
 | 
					    rt_resource_id id  = rtGetResourceID("assets/test.framegraph");
 | 
				
			||||||
    rt_temp_arena temp = rtGetTemporaryArena(NULL, 0);
 | 
					    rt_temp_arena temp = rtGetTemporaryArena(NULL, 0);
 | 
				
			||||||
 | 
					    while (rtGetResourceSize(id) == 0)
 | 
				
			||||||
 | 
					        ;
 | 
				
			||||||
    rt_resource *resource =
 | 
					    rt_resource *resource =
 | 
				
			||||||
        rtArenaPush(temp.arena, rtGetResourceSize(id));
 | 
					        rtArenaPush(temp.arena, rtGetResourceSize(id));
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@ -72,5 +82,6 @@ void Init(void) {
 | 
				
			|||||||
/* Called after exiting the main-loop and before the runtime starts its shutdown */
 | 
					/* Called after exiting the main-loop and before the runtime starts its shutdown */
 | 
				
			||||||
void Shutdown(void) {
 | 
					void Shutdown(void) {
 | 
				
			||||||
    rtLog("GAME", "Shutdown");
 | 
					    rtLog("GAME", "Shutdown");
 | 
				
			||||||
 | 
					    rtShutdownAssetCompiler();
 | 
				
			||||||
    rtDestroyFramegraph(_framegraph);
 | 
					    rtDestroyFramegraph(_framegraph);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										10
									
								
								src/game/meson.build
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/game/meson.build
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					vy_link_libs = engine_link_libs
 | 
				
			||||||
 | 
					vy_link_libs += asset_compiler
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					executable('voyage',
 | 
				
			||||||
 | 
					  'entry.c',
 | 
				
			||||||
 | 
					  'main.c',
 | 
				
			||||||
 | 
					  link_with : vy_link_libs,
 | 
				
			||||||
 | 
					  include_directories : engine_incdir,
 | 
				
			||||||
 | 
					  c_pch : 'pch/game_pch.h',
 | 
				
			||||||
 | 
					  win_subsystem : 'windows')
 | 
				
			||||||
							
								
								
									
										2
									
								
								src/game/pch/game_pch.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/game/pch/game_pch.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					// Runtime dir
 | 
				
			||||||
 | 
					#include "runtime/runtime.h"
 | 
				
			||||||
							
								
								
									
										5
									
								
								src/meson.build
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/meson.build
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					subdir('runtime')
 | 
				
			||||||
 | 
					subdir('asset_compiler')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Renderer libs
 | 
				
			||||||
 | 
					subdir('renderer/vk')
 | 
				
			||||||
							
								
								
									
										36
									
								
								src/renderer/vk/meson.build
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								src/renderer/vk/meson.build
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,36 @@
 | 
				
			|||||||
 | 
					if vk_dep.found()
 | 
				
			||||||
 | 
					  platform_defs = []
 | 
				
			||||||
 | 
					  if get_option('use_xlib')
 | 
				
			||||||
 | 
					    platform_defs = ['-DVK_USE_PLATFORM_XLIB_KHR']
 | 
				
			||||||
 | 
					  elif host_machine.system() == 'windows'
 | 
				
			||||||
 | 
					    platform_defs = ['-DVK_USE_PLATFORM_WIN32_KHR']
 | 
				
			||||||
 | 
					  endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  vk_inc_dep = vk_dep.partial_dependency(compile_args : true, includes : true)
 | 
				
			||||||
 | 
					  vk_renderer_lib = library('rtvk',
 | 
				
			||||||
 | 
					    # Project Sources
 | 
				
			||||||
 | 
					    'gpu.h',
 | 
				
			||||||
 | 
					    'pipelines.h',
 | 
				
			||||||
 | 
					    'render_targets.h',
 | 
				
			||||||
 | 
					    'swapchain.h',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    'helper.c',
 | 
				
			||||||
 | 
					    'init.c',
 | 
				
			||||||
 | 
					    'pipelines.c',
 | 
				
			||||||
 | 
					    'render_targets.c',
 | 
				
			||||||
 | 
					    'swapchain.c',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Contrib Sources
 | 
				
			||||||
 | 
					    contrib_dir / 'volk/volk.h',
 | 
				
			||||||
 | 
					    contrib_dir / 'volk/volk.c',
 | 
				
			||||||
 | 
					    contrib_dir / 'vma/vk_mem_alloc.h',
 | 
				
			||||||
 | 
					   'vma_impl.cpp',
 | 
				
			||||||
 | 
					    dependencies : [m_dep, vk_inc_dep, windowing_dep],
 | 
				
			||||||
 | 
					    include_directories : [engine_incdir, include_directories(contrib_dir)],
 | 
				
			||||||
 | 
					    link_with : [runtime_lib],
 | 
				
			||||||
 | 
					    c_pch : 'pch/vk_pch.h',
 | 
				
			||||||
 | 
					    c_args : platform_defs,
 | 
				
			||||||
 | 
					    cpp_pch : 'pch/vk_pch.h',
 | 
				
			||||||
 | 
					    cpp_args : platform_defs)
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -32,6 +32,9 @@ rtWin32Entry(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int n
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    rtRegisterRendererCVars();
 | 
					    rtRegisterRendererCVars();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (app_callbacks.RegisterCVars)
 | 
				
			||||||
 | 
					        app_callbacks.RegisterCVars();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    WNDCLASSEXW wndclass = {
 | 
					    WNDCLASSEXW wndclass = {
 | 
				
			||||||
        .cbSize        = sizeof(wndclass),
 | 
					        .cbSize        = sizeof(wndclass),
 | 
				
			||||||
        .hInstance     = hInstance,
 | 
					        .hInstance     = hInstance,
 | 
				
			||||||
@ -165,7 +168,9 @@ RT_DLLEXPORT int rtXlibEntry(int argc, char **argv, rt_app_callbacks app_callbac
 | 
				
			|||||||
        return 1;
 | 
					        return 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rtRegisterRendererCVars();
 | 
					    rtRegisterRendererCVars();
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    if (app_callbacks.RegisterCVars())
 | 
				
			||||||
 | 
					        app_callbacks.RegisterCVars();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Display *dpy = XOpenDisplay(NULL);
 | 
					    Display *dpy = XOpenDisplay(NULL);
 | 
				
			||||||
    if (!dpy) {
 | 
					    if (!dpy) {
 | 
				
			||||||
 | 
				
			|||||||
@ -9,10 +9,14 @@
 | 
				
			|||||||
extern "C" {
 | 
					extern "C" {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef void rt_app_register_cvars_fn(void);
 | 
				
			||||||
typedef void rt_app_init_fn(void);
 | 
					typedef void rt_app_init_fn(void);
 | 
				
			||||||
typedef void rt_app_shutdown_fn(void);
 | 
					typedef void rt_app_shutdown_fn(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
 | 
					    /* Called before initialization. */
 | 
				
			||||||
 | 
					    rt_app_register_cvars_fn *RegisterCVars;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Called after the runtime has finished initialization and
 | 
					    /* Called after the runtime has finished initialization and
 | 
				
			||||||
     * before entering the main-loop */
 | 
					     * before entering the main-loop */
 | 
				
			||||||
    rt_app_init_fn *Init;
 | 
					    rt_app_init_fn *Init;
 | 
				
			||||||
 | 
				
			|||||||
@ -12,6 +12,8 @@ static unsigned int _next = 0;
 | 
				
			|||||||
static rt_mutex *_mutex   = NULL;
 | 
					static rt_mutex *_mutex   = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void rtRegisterCVAR(rt_cvar *cvar) {
 | 
					void rtRegisterCVAR(rt_cvar *cvar) {
 | 
				
			||||||
 | 
					    /* TODO(Kevin): Check if we have a loaded value for that cvar. 
 | 
				
			||||||
 | 
					     * If yes, override the provided default value. */
 | 
				
			||||||
    if (!_mutex)
 | 
					    if (!_mutex)
 | 
				
			||||||
        _mutex = rtCreateMutex();
 | 
					        _mutex = rtCreateMutex();
 | 
				
			||||||
    rtLockMutex(_mutex);
 | 
					    rtLockMutex(_mutex);
 | 
				
			||||||
 | 
				
			|||||||
@ -18,10 +18,6 @@ extern rt_cvar rt_ResourceNamespaceSize;
 | 
				
			|||||||
extern rt_cvar rt_DisableResourceNamespaceLoad;
 | 
					extern rt_cvar rt_DisableResourceNamespaceLoad;
 | 
				
			||||||
extern rt_cvar rt_MaxFramegraphs;
 | 
					extern rt_cvar rt_MaxFramegraphs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef RT_BUILD_ASSET_COMPILER
 | 
					 | 
				
			||||||
extern rt_cvar rt_AssetDirectory;
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void RegisterRuntimeCVars(void) {
 | 
					void RegisterRuntimeCVars(void) {
 | 
				
			||||||
    rtRegisterCVAR(&rt_Renderer);
 | 
					    rtRegisterCVAR(&rt_Renderer);
 | 
				
			||||||
    rtRegisterCVAR(&rt_Fullscreen);
 | 
					    rtRegisterCVAR(&rt_Fullscreen);
 | 
				
			||||||
@ -36,9 +32,6 @@ void RegisterRuntimeCVars(void) {
 | 
				
			|||||||
    rtRegisterCVAR(&rt_ResourceNamespaceSize);
 | 
					    rtRegisterCVAR(&rt_ResourceNamespaceSize);
 | 
				
			||||||
    rtRegisterCVAR(&rt_DisableResourceNamespaceLoad);
 | 
					    rtRegisterCVAR(&rt_DisableResourceNamespaceLoad);
 | 
				
			||||||
    rtRegisterCVAR(&rt_MaxFramegraphs);
 | 
					    rtRegisterCVAR(&rt_MaxFramegraphs);
 | 
				
			||||||
#ifdef RT_BUILD_ASSET_COMPILER
 | 
					 | 
				
			||||||
    rtRegisterCVAR(&rt_AssetDirectory);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern void SetMainThreadId(void);
 | 
					extern void SetMainThreadId(void);
 | 
				
			||||||
@ -52,11 +45,6 @@ extern void ShutdownAIO(void);
 | 
				
			|||||||
extern rt_result InitResourceManager(void);
 | 
					extern rt_result InitResourceManager(void);
 | 
				
			||||||
extern void ShutdownResourceManager(void);
 | 
					extern void ShutdownResourceManager(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef RT_BUILD_ASSET_COMPILER
 | 
					 | 
				
			||||||
extern rt_result InitAssetCompiler(void);
 | 
					 | 
				
			||||||
extern void ShutdownAssetCompiler(void);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
RT_DLLEXPORT rt_result rtInitRuntime(void) {
 | 
					RT_DLLEXPORT rt_result rtInitRuntime(void) {
 | 
				
			||||||
    SetMainThreadId();
 | 
					    SetMainThreadId();
 | 
				
			||||||
    RegisterRuntimeCVars();
 | 
					    RegisterRuntimeCVars();
 | 
				
			||||||
@ -82,20 +70,10 @@ RT_DLLEXPORT rt_result rtInitRuntime(void) {
 | 
				
			|||||||
        return res;
 | 
					        return res;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef RT_BUILD_ASSET_COMPILER
 | 
					 | 
				
			||||||
    if ((res = InitAssetCompiler()) != RT_SUCCESS) {
 | 
					 | 
				
			||||||
        rtReportError("AC", "Init failed.");
 | 
					 | 
				
			||||||
        return res;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return RT_SUCCESS;
 | 
					    return RT_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RT_DLLEXPORT void rtShutdownRuntime(void) {
 | 
					RT_DLLEXPORT void rtShutdownRuntime(void) {
 | 
				
			||||||
#ifdef RT_BUILD_ASSET_COMPILER
 | 
					 | 
				
			||||||
    ShutdownAssetCompiler();
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
    ShutdownResourceManager();
 | 
					    ShutdownResourceManager();
 | 
				
			||||||
    ShutdownAIO();
 | 
					    ShutdownAIO();
 | 
				
			||||||
    ShutdownFileTab();
 | 
					    ShutdownFileTab();
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										55
									
								
								src/runtime/meson.build
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								src/runtime/meson.build
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,55 @@
 | 
				
			|||||||
 | 
					# Runtime 
 | 
				
			||||||
 | 
					runtime_deps = [thread_dep, m_dep, windowing_dep]
 | 
				
			||||||
 | 
					runtime_incdirs = include_directories(meson.project_source_root() / 'contrib')
 | 
				
			||||||
 | 
					runtime_lib = library('rt',
 | 
				
			||||||
 | 
					  # Project Sources
 | 
				
			||||||
 | 
					  'aio.h',
 | 
				
			||||||
 | 
					  'app.h',
 | 
				
			||||||
 | 
					  'buffer_manager.h',
 | 
				
			||||||
 | 
					  'compression.h',
 | 
				
			||||||
 | 
					  'config.h',
 | 
				
			||||||
 | 
					  'ds.h',
 | 
				
			||||||
 | 
					  'dynamic_libs.h',
 | 
				
			||||||
 | 
					  'file_tab.h',
 | 
				
			||||||
 | 
					  'fsutils.h',
 | 
				
			||||||
 | 
					  'gfx.h',
 | 
				
			||||||
 | 
					  'handles.h',
 | 
				
			||||||
 | 
					  'hashing.h',
 | 
				
			||||||
 | 
					  'jobs.h',
 | 
				
			||||||
 | 
					  'mem_arena.h',
 | 
				
			||||||
 | 
					  'renderer_api.h',
 | 
				
			||||||
 | 
					  'resources.h',
 | 
				
			||||||
 | 
					  'runtime.h',
 | 
				
			||||||
 | 
					  'threading.h',
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  'aio.c',
 | 
				
			||||||
 | 
					  'app.c',
 | 
				
			||||||
 | 
					  'assert.c',
 | 
				
			||||||
 | 
					  'buffer_manager.c',
 | 
				
			||||||
 | 
					  'compression.c',
 | 
				
			||||||
 | 
					  'config.c',
 | 
				
			||||||
 | 
					  'ds_minheap.c',
 | 
				
			||||||
 | 
					  'dynamic_libs.c',
 | 
				
			||||||
 | 
					  'error_report.c',
 | 
				
			||||||
 | 
					  'file_tab.c',
 | 
				
			||||||
 | 
					  'fsutils.c',
 | 
				
			||||||
 | 
					  'gfx_framegraph.c',
 | 
				
			||||||
 | 
					  'gfx_main.c',
 | 
				
			||||||
 | 
					  'hashing.c',
 | 
				
			||||||
 | 
					  'init.c',
 | 
				
			||||||
 | 
					  'jobs.c',
 | 
				
			||||||
 | 
					  'mem_arena.c',
 | 
				
			||||||
 | 
					  'resource_manager.c',
 | 
				
			||||||
 | 
					  'sprint.c',
 | 
				
			||||||
 | 
					  'text.c',
 | 
				
			||||||
 | 
					  'threading_cond.c',
 | 
				
			||||||
 | 
					  'threading_mutex.c',
 | 
				
			||||||
 | 
					  'threading_rwlock.c',
 | 
				
			||||||
 | 
					  'threading_thread.c',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Contrib Sources
 | 
				
			||||||
 | 
					  contrib_dir / 'xxhash/xxhash.c',
 | 
				
			||||||
 | 
					  contrib_dir / 'lz4/lz4.c',
 | 
				
			||||||
 | 
					  dependencies : runtime_deps,
 | 
				
			||||||
 | 
					  include_directories : [engine_incdir, runtime_incdirs],
 | 
				
			||||||
 | 
					  c_pch : 'pch/rt_pch.h')
 | 
				
			||||||
							
								
								
									
										6
									
								
								tests/meson.build
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								tests/meson.build
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					rttest_exe = executable('rttest',
 | 
				
			||||||
 | 
					  'rttest.c',
 | 
				
			||||||
 | 
					  link_with : engine_link_libs,
 | 
				
			||||||
 | 
					  include_directories : engine_incdir,
 | 
				
			||||||
 | 
					  win_subsystem : 'console')
 | 
				
			||||||
 | 
					test('runtime test', rttest_exe)
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user