reorganizing milepost directory tree into app, graphics, platfrom, ui, util

This commit is contained in:
Martin Fouilleul 2023-08-09 17:30:35 +02:00
parent 11dde9fea3
commit bfadcad7f3
51 changed files with 11159 additions and 11155 deletions

View File

@ -10,7 +10,7 @@
#define __OSX_APP_H_ #define __OSX_APP_H_
#include"mp_app.h" #include"mp_app.h"
#include"graphics.h" #include"graphics/graphics.h"
#ifdef __OBJC__ #ifdef __OBJC__
#import<Cocoa/Cocoa.h> #import<Cocoa/Cocoa.h>

View File

@ -18,7 +18,7 @@
#include"macro_helpers.h" #include"macro_helpers.h"
#include"platform_log.h" #include"platform_log.h"
#include"platform_clock.h" #include"platform_clock.h"
#include"graphics_surface.h" #include"graphics/graphics_surface.h"
#include"mp_app.c" #include"mp_app.c"

View File

@ -1075,7 +1075,7 @@ MP_API str8 mp_clipboard_copy_string(str8 backing)
// win32 surfaces // win32 surfaces
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
#include"graphics_surface.h" #include"graphics/graphics_surface.h"
vec2 mg_win32_surface_contents_scaling(mg_surface_data* surface) vec2 mg_win32_surface_contents_scaling(mg_surface_data* surface)
{ {

View File

@ -10,7 +10,7 @@
#define EGL_EGLEXT_PROTOTYPES #define EGL_EGLEXT_PROTOTYPES
#include<EGL/egl.h> #include<EGL/egl.h>
#include<EGL/eglext.h> #include<EGL/eglext.h>
#include"mp_app_internal.h" #include"app/mp_app_internal.h"
#include"graphics_surface.h" #include"graphics_surface.h"
#include"gl_loader.h" #include"gl_loader.h"

View File

@ -10,7 +10,7 @@
#define __EGL_SURFACE_H_ #define __EGL_SURFACE_H_
#include"graphics_surface.h" #include"graphics_surface.h"
#include"mp_app.h" #include"app/mp_app.h"
mg_surface_data* mg_egl_surface_create_for_window(mp_window window); mg_surface_data* mg_egl_surface_create_for_window(mp_window window);
mg_surface_data* mg_egl_surface_create_remote(u32 width, u32 height); mg_surface_data* mg_egl_surface_create_remote(u32 width, u32 height);

View File

@ -11,7 +11,7 @@
#include"util/typedefs.h" #include"util/typedefs.h"
#include"platform/platform.h" #include"platform/platform.h"
#include"mp_app.h" #include"app/mp_app.h"
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------
//NOTE(martin): backends selection //NOTE(martin): backends selection

View File

@ -9,7 +9,7 @@
#define __GRAPHICS_SURFACE_H_ #define __GRAPHICS_SURFACE_H_
#include"graphics_common.h" #include"graphics_common.h"
#include"mp_app_internal.h" #include"app/mp_app_internal.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -10,10 +10,10 @@
#import<QuartzCore/CAMetalLayer.h> #import<QuartzCore/CAMetalLayer.h>
#include<simd/simd.h> #include<simd/simd.h>
#include"graphics_surface.h" #include"util/macro_helpers.h"
#include"macro_helpers.h" #include"app/osx_app.h"
#include"osx_app.h"
#include"graphics_surface.h"
#include"mtl_renderer.h" #include"mtl_renderer.h"
const int MG_MTL_INPUT_BUFFERS_COUNT = 3, const int MG_MTL_INPUT_BUFFERS_COUNT = 3,

View File

@ -12,8 +12,8 @@
#include<simd/simd.h> #include<simd/simd.h>
#include"graphics_surface.h" #include"graphics_surface.h"
#include"macro_helpers.h" #include"util/macro_helpers.h"
#include"osx_app.h" #include"app/osx_app.h"
typedef struct mg_mtl_surface typedef struct mg_mtl_surface
{ {

View File

@ -6,12 +6,12 @@
* @revision: * @revision:
* *
*****************************************************************/ *****************************************************************/
#include"win32_app.h" #include"app/win32_app.h"
#include"graphics_surface.h" #include"graphics_surface.h"
#include"gl_loader.h" #include"gl_loader.h"
#include<GL/wglext.h> #include<GL/wglext.h>
#include"macro_helpers.h" #include"util/macro_helpers.h"
#define WGL_PROC_LIST \ #define WGL_PROC_LIST \
WGL_PROC(WGLCHOOSEPIXELFORMATARB, wglChoosePixelFormatARB) \ WGL_PROC(WGLCHOOSEPIXELFORMATARB, wglChoosePixelFormatARB) \

View File

@ -60,24 +60,24 @@
//--------------------------------------------------------------- //---------------------------------------------------------------
#if PLATFORM_WINDOWS #if PLATFORM_WINDOWS
#include"win32_app.c" #include"app/win32_app.c"
#include"graphics_common.c" #include"graphics/graphics_common.c"
#include"graphics_surface.c" #include"graphics/graphics_surface.c"
#if MG_COMPILE_GL || MG_COMPILE_GLES #if MG_COMPILE_GL || MG_COMPILE_GLES
#include"gl_loader.c" #include"graphics/gl_loader.c"
#endif #endif
#if MG_COMPILE_GL #if MG_COMPILE_GL
#include"wgl_surface.c" #include"graphics/wgl_surface.c"
#endif #endif
#if MG_COMPILE_CANVAS #if MG_COMPILE_CANVAS
#include"gl_canvas.c" #include"graphics/gl_canvas.c"
#endif #endif
#if MG_COMPILE_GLES #if MG_COMPILE_GLES
#include"egl_surface.c" #include"graphics/egl_surface.c"
#endif #endif
#elif PLATFORM_MACOS #elif PLATFORM_MACOS
@ -86,5 +86,5 @@
#error "Unsupported platform" #error "Unsupported platform"
#endif #endif
#include"input_state.c" #include"ui/input_state.c"
#include"ui.c" #include"ui/ui.c"

View File

@ -38,15 +38,13 @@
//---------------------------------------------------------------- //----------------------------------------------------------------
// application/graphics layer // application/graphics layer
//---------------------------------------------------------------- //----------------------------------------------------------------
#include"mp_app.h" #include"app/mp_app.h"
#include"graphics.h" #include"graphics/graphics.h"
#include"input_state.h" #include"ui/input_state.h"
#include"ui.h" #include"ui/ui.h"
#ifdef MG_INCLUDE_GL_API #ifdef MG_INCLUDE_GL_API
#include"gl_api.h" #include"graphics/gl_api.h"
#endif #endif
//#include"ui.h"
#endif //__MILEPOST_H_ #endif //__MILEPOST_H_

View File

@ -7,20 +7,20 @@
* *
*****************************************************************/ *****************************************************************/
#include"osx_path.m" #include"platform/osx_path.m"
#include"osx_app.m" #include"app/osx_app.m"
#include"graphics_common.c" #include"graphics/graphics_common.c"
#include"graphics_surface.c" #include"graphics/graphics_surface.c"
#if MG_COMPILE_METAL #if MG_COMPILE_METAL
#include"mtl_surface.m" #include"graphics/mtl_surface.m"
#endif #endif
#if MG_COMPILE_CANVAS #if MG_COMPILE_CANVAS
#include"mtl_renderer.m" #include"graphics/mtl_renderer.m"
#endif #endif
#if MG_COMPILE_GLES #if MG_COMPILE_GLES
#include"gl_loader.c" #include"graphics/gl_loader.c"
#include"egl_surface.c" #include"graphics/egl_surface.c"
#endif #endif

View File

@ -12,7 +12,7 @@
#include"util/typedefs.h" #include"util/typedefs.h"
#include"util/strings.h" #include"util/strings.h"
#include"util/utf8.h" #include"util/utf8.h"
#include"mp_app.h" #include"app/mp_app.h"
typedef struct mp_key_state typedef struct mp_key_state
{ {

View File

@ -12,7 +12,7 @@
#include"util/typedefs.h" #include"util/typedefs.h"
#include"util/lists.h" #include"util/lists.h"
#include"input_state.h" #include"input_state.h"
#include"graphics.h" #include"graphics/graphics.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -1,5 +1,4 @@
#include <keys.h> #include <keys.h>
#include <graphics.h>
#include <math.h> #include <math.h>
#include <orca.h> #include <orca.h>

View File

@ -11,6 +11,7 @@ else
CLANG=clang CLANG=clang
fi fi
ORCA_DIR=../..
STDLIB_DIR=../../cstdlib STDLIB_DIR=../../cstdlib
ORCA_SDK_DIR=../../sdk ORCA_SDK_DIR=../../sdk
MILEPOST_DIR=../../milepost MILEPOST_DIR=../../milepost
@ -25,6 +26,7 @@ wasmFlags="--target=wasm32 \
-mbulk-memory \ -mbulk-memory \
-D__ORCA__ \ -D__ORCA__ \
-I $STDLIB_DIR/include \ -I $STDLIB_DIR/include \
-I $ORCA_DIR/ext \
-I $ORCA_SDK_DIR \ -I $ORCA_SDK_DIR \
-I $MILEPOST_DIR/ext -I $MILEPOST_DIR -I $MILEPOST_DIR/src" -I $MILEPOST_DIR/ext -I $MILEPOST_DIR -I $MILEPOST_DIR/src"

View File

@ -1,5 +1,4 @@
#include <keys.h> #include <keys.h>
#include <graphics.h>
#include <math.h> #include <math.h>
#include <orca.h> #include <orca.h>

View File

@ -11,6 +11,8 @@ else
CLANG=clang CLANG=clang
fi fi
ORCA_DIR=../..
wasmFlags="--target=wasm32 \ wasmFlags="--target=wasm32 \
--no-standard-libraries \ --no-standard-libraries \
-fno-builtin \ -fno-builtin \
@ -20,6 +22,7 @@ wasmFlags="--target=wasm32 \
-O2 \ -O2 \
-mbulk-memory \ -mbulk-memory \
-D__ORCA__ \ -D__ORCA__ \
-I $ORCA_DIR/ext \
-isystem ../../cstdlib/include -I ../../sdk -I../../milepost/ext -I ../../milepost -I ../../milepost/src" -isystem ../../cstdlib/include -I ../../sdk -I../../milepost/ext -I ../../milepost -I ../../milepost/src"
$CLANG $wasmFlags -o ./module.wasm ../../sdk/orca.c ../../cstdlib/src/*.c src/main.c $CLANG $wasmFlags -o ./module.wasm ../../sdk/orca.c ../../cstdlib/src/*.c src/main.c

View File

@ -1,6 +1,4 @@
#include"keys.h" #include"keys.h"
#include"graphics.h"
#include"ui.h"
#include"orca.h" #include"orca.h"

View File

@ -168,7 +168,7 @@ def build_milepost_lib_mac(release):
# TODO: shaderFlagParam # TODO: shaderFlagParam
"-fno-fast-math", "-c", "-fno-fast-math", "-c",
"-o", "../build/mtl_renderer.air", "-o", "../build/mtl_renderer.air",
"src/mtl_renderer.metal", "src/graphics/mtl_renderer.metal",
], check=True) ], check=True)
subprocess.run([ subprocess.run([
"xcrun", "-sdk", "macosx", "metallib", "xcrun", "-sdk", "macosx", "metallib",
@ -302,7 +302,8 @@ def build_orca_win(release):
includes = [ includes = [
"/I", "src", "/I", "src",
"/I", "sdk", "/I", "sdk",
"/I", "ext" "/I", "ext",
"/I", "ext/angle/include",
"/I", "ext/wasm3/source", "/I", "ext/wasm3/source",
"/I", "milepost/src" "/I", "milepost/src"
] ]
@ -332,6 +333,7 @@ def build_orca_mac(release):
"-Imilepost/src/util", "-Imilepost/src/util",
"-Imilepost/src/platform", "-Imilepost/src/platform",
"-Iext", "-Iext",
"-Iext/angle/include",
"-Iext/wasm3/source" "-Iext/wasm3/source"
] ]
libs = ["-Lbuild/bin", "-Lbuild/lib", "-lmilepost", "-lwasm3"] libs = ["-Lbuild/bin", "-Lbuild/lib", "-lmilepost", "-lwasm3"]
@ -380,12 +382,12 @@ def gen_all_bindings():
bindgen("canvas", "src/canvas_api.json", bindgen("canvas", "src/canvas_api.json",
guest_stubs="sdk/orca_surface.c", guest_stubs="sdk/orca_surface.c",
guest_include="graphics.h", guest_include="graphics/graphics.h",
wasm3_bindings="src/canvas_api_bind_gen.c", wasm3_bindings="src/canvas_api_bind_gen.c",
) )
bindgen("clock", "src/clock_api.json", bindgen("clock", "src/clock_api.json",
guest_stubs="sdk/orca_clock.c", guest_stubs="sdk/orca_clock.c",
guest_include="platform_clock.h", guest_include="platform/platform_clock.h",
wasm3_bindings="src/clock_api_bind_gen.c", wasm3_bindings="src/clock_api_bind_gen.c",
) )
bindgen("io", "src/io_api.json", bindgen("io", "src/io_api.json",

View File

@ -18,10 +18,10 @@
#include"util/strings.c" #include"util/strings.c"
#include"util/utf8.c" #include"util/utf8.c"
#include"graphics_common.c" #include"graphics/graphics_common.c"
#include"input_state.c" #include"ui/input_state.c"
#include"ui/ui.c"
#include"orca_exports.c" #include"orca_exports.c"
#include"orca_surface.c" #include"orca_surface.c"
#include"ui.c"
#include"io_stubs.c" #include"io_stubs.c"

View File

@ -21,7 +21,10 @@
#include"math.h" #include"math.h"
#include"graphics.h" #include"graphics/graphics.h"
#include"ui/input_state.h"
#include"ui/ui.h"
#include"gl31.h" #include"gl31.h"
#if COMPILER_CLANG #if COMPILER_CLANG

View File

@ -11,7 +11,7 @@
#define MG_INCLUDE_GL_API #define MG_INCLUDE_GL_API
#include"milepost.h" #include"milepost.h"
#include"graphics_common.h" #include"graphics/graphics_common.h"
#include"orca_app.h" #include"orca_app.h"