mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 14:43:34 +00:00
fixing windows dll issues
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -5,10 +5,16 @@
|
|||||||
*.so
|
*.so
|
||||||
*.out
|
*.out
|
||||||
*.dll
|
*.dll
|
||||||
|
*.lib
|
||||||
|
*.exp
|
||||||
*.json
|
*.json
|
||||||
*.tmp
|
*.tmp
|
||||||
|
*.ilk
|
||||||
|
*.pdb
|
||||||
|
.vs/
|
||||||
.xmake/
|
.xmake/
|
||||||
.cache/
|
.cache/
|
||||||
|
objs/
|
||||||
build/
|
build/
|
||||||
test/.gdb_history
|
test/.gdb_history
|
||||||
test/Test
|
test/Test
|
||||||
|
|||||||
1
Makefile
1
Makefile
@@ -13,6 +13,7 @@
|
|||||||
NAME = libmlx.so
|
NAME = libmlx.so
|
||||||
|
|
||||||
SRCS = $(wildcard $(addsuffix /*.cpp, ./src/core))
|
SRCS = $(wildcard $(addsuffix /*.cpp, ./src/core))
|
||||||
|
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/core/**))
|
||||||
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/platform))
|
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/platform))
|
||||||
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer))
|
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer))
|
||||||
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer/**))
|
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer/**))
|
||||||
|
|||||||
@@ -15,13 +15,9 @@
|
|||||||
#ifndef __MACRO_LIB_X_H__
|
#ifndef __MACRO_LIB_X_H__
|
||||||
#define __MACRO_LIB_X_H__
|
#define __MACRO_LIB_X_H__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
#define MLX_EXPORT __declspec(dllexport)
|
#define MLX_EXPORT __declspec(dllexport)
|
||||||
#define MLX_IMPORT __declspec(dllexport)
|
#define MLX_IMPORT __declspec(dllimport)
|
||||||
#else
|
#else
|
||||||
#define MLX_EXPORT
|
#define MLX_EXPORT
|
||||||
#define MLX_IMPORT
|
#define MLX_IMPORT
|
||||||
@@ -33,6 +29,10 @@ extern "C" {
|
|||||||
#define MLX_API MLX_IMPORT
|
#define MLX_API MLX_IMPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
MLX_KEYDOWN = 0,
|
MLX_KEYDOWN = 0,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
namespace mlx::core
|
namespace mlx::core
|
||||||
{
|
{
|
||||||
class MLX_API Application
|
class Application
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Application();
|
Application();
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include <renderer/core/render_core.h>
|
#include <renderer/core/render_core.h>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <mlx.h>
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
@@ -31,29 +32,29 @@ extern "C"
|
|||||||
if(app == nullptr)
|
if(app == nullptr)
|
||||||
mlx::core::error::report(e_kind::fatal_error, "Tout a pété");
|
mlx::core::error::report(e_kind::fatal_error, "Tout a pété");
|
||||||
init = true;
|
init = true;
|
||||||
return app;
|
return static_cast<void*>(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* mlx_new_window(mlx::core::Application* mlx, int w, int h, const char* title)
|
void* mlx_new_window(void* mlx, int w, int h, const char* title)
|
||||||
{
|
{
|
||||||
return mlx->newGraphicsSuport(w, h, title);
|
return static_cast<mlx::core::Application*>(mlx)->newGraphicsSuport(w, h, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_loop_hook(mlx::core::Application* mlx, int (*f)(void*), void* param)
|
int mlx_loop_hook(void* mlx, int (*f)(void*), void* param)
|
||||||
{
|
{
|
||||||
mlx->loopHook(f, param);
|
static_cast<mlx::core::Application*>(mlx)->loopHook(f, param);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_loop(mlx::core::Application* mlx)
|
int mlx_loop(void* mlx)
|
||||||
{
|
{
|
||||||
mlx->run();
|
static_cast<mlx::core::Application*>(mlx)->run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_loop_end(mlx::core::Application* mlx)
|
int mlx_loop_end(void* mlx)
|
||||||
{
|
{
|
||||||
mlx->loopEnd();
|
static_cast<mlx::core::Application*>(mlx)->loopEnd();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,57 +68,57 @@ extern "C"
|
|||||||
return SDL_ShowCursor(SDL_DISABLE);
|
return SDL_ShowCursor(SDL_DISABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_mouse_move(mlx::core::Application* mlx, void* win, int x, int y)
|
int mlx_mouse_move(void* mlx, void* win, int x, int y)
|
||||||
{
|
{
|
||||||
mlx->mouseMove(win, x, y);
|
static_cast<mlx::core::Application*>(mlx)->mouseMove(win, x, y);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_mouse_get_pos(mlx::core::Application* mlx, int* x, int* y)
|
int mlx_mouse_get_pos(void* mlx, int* x, int* y)
|
||||||
{
|
{
|
||||||
mlx->getMousePos(x, y);
|
static_cast<mlx::core::Application*>(mlx)->getMousePos(x, y);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_on_event(mlx::core::Application* mlx, void* win, int event, int (*funct_ptr)(int, void*), void* param)
|
int mlx_on_event(void* mlx, void* win, mlx_event_type event, int (*funct_ptr)(int, void*), void* param)
|
||||||
{
|
{
|
||||||
mlx->onEvent(win, event, funct_ptr, param);
|
static_cast<mlx::core::Application*>(mlx)->onEvent(win, static_cast<int>(event), funct_ptr, param);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* mlx_new_image(mlx::core::Application* mlx, int width, int height)
|
void* mlx_new_image(void* mlx, int width, int height)
|
||||||
{
|
{
|
||||||
return mlx->newTexture(width, height);
|
return static_cast<mlx::core::Application*>(mlx)->newTexture(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_get_image_pixel(mlx::core::Application* mlx, void* img, int x, int y)
|
int mlx_get_image_pixel(void* mlx, void* img, int x, int y)
|
||||||
{
|
{
|
||||||
return mlx->getTexturePixel(img, x, y);
|
return static_cast<mlx::core::Application*>(mlx)->getTexturePixel(img, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mlx_set_image_pixel(mlx::core::Application* mlx, void* img, int x, int y, int color)
|
void mlx_set_image_pixel(void* mlx, void* img, int x, int y, int color)
|
||||||
{
|
{
|
||||||
unsigned char color_bits[4];
|
unsigned char color_bits[4];
|
||||||
color_bits[0] = (color & 0x00FF0000) >> 16;
|
color_bits[0] = (color & 0x00FF0000) >> 16;
|
||||||
color_bits[1] = (color & 0x0000FF00) >> 8;
|
color_bits[1] = (color & 0x0000FF00) >> 8;
|
||||||
color_bits[2] = (color & 0x000000FF);
|
color_bits[2] = (color & 0x000000FF);
|
||||||
color_bits[3] = (color & 0xFF000000) >> 24;
|
color_bits[3] = (color & 0xFF000000) >> 24;
|
||||||
mlx->setTexturePixel(img, x, y, *reinterpret_cast<unsigned int*>(color_bits));
|
static_cast<mlx::core::Application*>(mlx)->setTexturePixel(img, x, y, *reinterpret_cast<unsigned int*>(color_bits));
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_put_image_to_window(mlx::core::Application* mlx, void* win, void* img, int x, int y)
|
int mlx_put_image_to_window(void* mlx, void* win, void* img, int x, int y)
|
||||||
{
|
{
|
||||||
mlx->texturePut(win, img, x, y);
|
static_cast<mlx::core::Application*>(mlx)->texturePut(win, img, x, y);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_destroy_image(mlx::core::Application* mlx, void* img)
|
int mlx_destroy_image(void* mlx, void* img)
|
||||||
{
|
{
|
||||||
mlx->destroyTexture(img);
|
static_cast<mlx::core::Application*>(mlx)->destroyTexture(img);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* mlx_png_file_to_image(mlx::core::Application* mlx, char* filename, int* width, int* height)
|
void* mlx_png_file_to_image(void* mlx, char* filename, int* width, int* height)
|
||||||
{
|
{
|
||||||
std::filesystem::path file(filename);
|
std::filesystem::path file(filename);
|
||||||
if(file.extension() != ".png")
|
if(file.extension() != ".png")
|
||||||
@@ -125,10 +126,10 @@ extern "C"
|
|||||||
mlx::core::error::report(e_kind::error, "PNG loader : not a png file '%s'", filename);
|
mlx::core::error::report(e_kind::error, "PNG loader : not a png file '%s'", filename);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return mlx->newStbTexture(filename, width, height);
|
return static_cast<mlx::core::Application*>(mlx)->newStbTexture(filename, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* mlx_jpg_file_to_image(mlx::core::Application* mlx, char* filename, int* width, int* height)
|
void* mlx_jpg_file_to_image(void* mlx, char* filename, int* width, int* height)
|
||||||
{
|
{
|
||||||
std::filesystem::path file(filename);
|
std::filesystem::path file(filename);
|
||||||
if(file.extension() != ".jpg" && file.extension() != ".jpeg")
|
if(file.extension() != ".jpg" && file.extension() != ".jpeg")
|
||||||
@@ -136,10 +137,10 @@ extern "C"
|
|||||||
mlx::core::error::report(e_kind::error, "JPG loader : not a jpg file '%s'", filename);
|
mlx::core::error::report(e_kind::error, "JPG loader : not a jpg file '%s'", filename);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return mlx->newStbTexture(filename, width, height);
|
return static_cast<mlx::core::Application*>(mlx)->newStbTexture(filename, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* mlx_bmp_file_to_image(mlx::core::Application* mlx, char* filename, int* width, int* height)
|
void* mlx_bmp_file_to_image(void* mlx, char* filename, int* width, int* height)
|
||||||
{
|
{
|
||||||
std::filesystem::path file(filename);
|
std::filesystem::path file(filename);
|
||||||
if(file.extension() != ".bmp" && file.extension() != ".dib")
|
if(file.extension() != ".bmp" && file.extension() != ".dib")
|
||||||
@@ -147,32 +148,32 @@ extern "C"
|
|||||||
mlx::core::error::report(e_kind::error, "BMP loader : not a bmp file '%s'", filename);
|
mlx::core::error::report(e_kind::error, "BMP loader : not a bmp file '%s'", filename);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return mlx->newStbTexture(filename, width, height);
|
return static_cast<mlx::core::Application*>(mlx)->newStbTexture(filename, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_pixel_put(mlx::core::Application* mlx, void* win, int x, int y, int color)
|
int mlx_pixel_put(void* mlx, void* win, int x, int y, int color)
|
||||||
{
|
{
|
||||||
unsigned char color_bits[4];
|
unsigned char color_bits[4];
|
||||||
color_bits[0] = (color & 0x00FF0000) >> 16;
|
color_bits[0] = (color & 0x00FF0000) >> 16;
|
||||||
color_bits[1] = (color & 0x0000FF00) >> 8;
|
color_bits[1] = (color & 0x0000FF00) >> 8;
|
||||||
color_bits[2] = color & 0x000000FF;
|
color_bits[2] = color & 0x000000FF;
|
||||||
color_bits[3] = 0xFF;
|
color_bits[3] = 0xFF;
|
||||||
mlx->pixelPut(win, x, y, *reinterpret_cast<unsigned int*>(color_bits));
|
static_cast<mlx::core::Application*>(mlx)->pixelPut(win, x, y, *reinterpret_cast<unsigned int*>(color_bits));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_string_put(mlx::core::Application* mlx, void* win, int x, int y, int color, char* str)
|
int mlx_string_put(void* mlx, void* win, int x, int y, int color, char* str)
|
||||||
{
|
{
|
||||||
unsigned char color_bits[4];
|
unsigned char color_bits[4];
|
||||||
color_bits[0] = (color & 0x00FF0000) >> 16;
|
color_bits[0] = (color & 0x00FF0000) >> 16;
|
||||||
color_bits[1] = (color & 0x0000FF00) >> 8;
|
color_bits[1] = (color & 0x0000FF00) >> 8;
|
||||||
color_bits[2] = color & 0x000000FF;
|
color_bits[2] = color & 0x000000FF;
|
||||||
color_bits[3] = 0xFF;
|
color_bits[3] = 0xFF;
|
||||||
mlx->stringPut(win, x, y, *reinterpret_cast<unsigned int*>(color_bits), str);
|
static_cast<mlx::core::Application*>(mlx)->stringPut(win, x, y, *reinterpret_cast<unsigned int*>(color_bits), str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mlx_set_font(mlx::core::Application* mlx, void* win, char* filepath)
|
void mlx_set_font(void* mlx, void* win, char* filepath)
|
||||||
{
|
{
|
||||||
std::filesystem::path file(filepath);
|
std::filesystem::path file(filepath);
|
||||||
if(file.extension() != ".ttf" && file.extension() != ".tte")
|
if(file.extension() != ".ttf" && file.extension() != ".tte")
|
||||||
@@ -180,10 +181,10 @@ extern "C"
|
|||||||
mlx::core::error::report(e_kind::error, "TTF loader : not a truetype font file '%s'", filepath);
|
mlx::core::error::report(e_kind::error, "TTF loader : not a truetype font file '%s'", filepath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mlx->loadFont(win, file, 16.f);
|
static_cast<mlx::core::Application*>(mlx)->loadFont(win, file, 16.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mlx_set_font_scale(mlx::core::Application* mlx, void* win, char* filepath, float scale)
|
void mlx_set_font_scale(void* mlx, void* win, char* filepath, float scale)
|
||||||
{
|
{
|
||||||
std::filesystem::path file(filepath);
|
std::filesystem::path file(filepath);
|
||||||
if(file.extension() != ".ttf" && file.extension() != ".tte")
|
if(file.extension() != ".ttf" && file.extension() != ".tte")
|
||||||
@@ -191,31 +192,31 @@ extern "C"
|
|||||||
mlx::core::error::report(e_kind::error, "TTF loader : not a truetype font file '%s'", filepath);
|
mlx::core::error::report(e_kind::error, "TTF loader : not a truetype font file '%s'", filepath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mlx->loadFont(win, file, scale);
|
static_cast<mlx::core::Application*>(mlx)->loadFont(win, file, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_clear_window(mlx::core::Application* mlx, void* win)
|
int mlx_clear_window(void* mlx, void* win)
|
||||||
{
|
{
|
||||||
mlx->clearGraphicsSupport(win);
|
static_cast<mlx::core::Application*>(mlx)->clearGraphicsSupport(win);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_destroy_window(mlx::core::Application* mlx, void* win)
|
int mlx_destroy_window(void* mlx, void* win)
|
||||||
{
|
{
|
||||||
mlx->destroyGraphicsSupport(win);
|
static_cast<mlx::core::Application*>(mlx)->destroyGraphicsSupport(win);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_destroy_display(mlx::core::Application* mlx)
|
int mlx_destroy_display(void* mlx)
|
||||||
{
|
{
|
||||||
delete mlx;
|
delete static_cast<mlx::core::Application*>(mlx);
|
||||||
mlx::Render_Core::get().destroy();
|
mlx::Render_Core::get().destroy();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlx_get_screens_size(mlx::core::Application* mlx, int* w, int* h)
|
int mlx_get_screens_size(void* mlx, int* w, int* h)
|
||||||
{
|
{
|
||||||
mlx->getScreenSize(w, h);
|
static_cast<mlx::core::Application*>(mlx)->getScreenSize(w, h);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ enum class e_kind
|
|||||||
|
|
||||||
namespace mlx::core::error
|
namespace mlx::core::error
|
||||||
{
|
{
|
||||||
void MLX_API report(e_kind kind, std::string msg, ...);
|
void report(e_kind kind, std::string msg, ...);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __MLX_ERRORS__
|
#endif // __MLX_ERRORS__
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API GraphicsSupport : public non_copyable
|
class GraphicsSupport : public non_copyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GraphicsSupport(std::size_t w, std::size_t h, const std::string& title, int id);
|
GraphicsSupport(std::size_t w, std::size_t h, const std::string& title, int id);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API MemManager : public Singleton<MemManager>
|
class MemManager : public Singleton<MemManager>
|
||||||
{
|
{
|
||||||
friend class Singleton<MemManager>;
|
friend class Singleton<MemManager>;
|
||||||
|
|
||||||
|
|||||||
@@ -41,19 +41,18 @@
|
|||||||
#warning "This compiler is not fully supported"
|
#warning "This compiler is not fully supported"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||||
#define MLX_EXPORT __declspec(dllexport)
|
#define MLX_PLAT_WINDOWS
|
||||||
#define MLX_IMPORT __declspec(dllexport)
|
#elif defined(__linux__)
|
||||||
|
#define MLX_PLAT_LINUX
|
||||||
|
#elif defined(__APPLE__) && defined(__MACH__)
|
||||||
|
#define MLX_PLAT_MACOS
|
||||||
|
#elif defined(unix) || defined(__unix__) || defined(__unix)
|
||||||
|
#define MLX_PLAT_UNIX
|
||||||
#else
|
#else
|
||||||
#define MLX_EXPORT
|
#error "Unknown environment!"
|
||||||
#define MLX_IMPORT
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MLX_BUILD
|
|
||||||
#define MLX_API MLX_EXPORT
|
|
||||||
#else
|
|
||||||
#define MLX_API MLX_IMPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Checking common assumptions
|
// Checking common assumptions
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace mlx
|
|||||||
void* param = nullptr;
|
void* param = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MLX_API Input
|
class Input
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Input();
|
Input();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API MLX_Window
|
class MLX_Window
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MLX_Window(std::size_t w, std::size_t h, const std::string& title);
|
MLX_Window(std::size_t w, std::size_t h, const std::string& title);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API Buffer
|
class Buffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class kind { dynamic, uniform, constant };
|
enum class kind { dynamic, uniform, constant };
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API C_IBO : public Buffer
|
class C_IBO : public Buffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline void create(uint32_t size, const uint16_t* data, const char* name) { Buffer::create(Buffer::kind::constant, size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, name, data); }
|
inline void create(uint32_t size, const uint16_t* data, const char* name) { Buffer::create(Buffer::kind::constant, size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, name, data); }
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API UBO
|
class UBO
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void create(class Renderer* renderer, uint32_t size, const char* name);
|
void create(class Renderer* renderer, uint32_t size, const char* name);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API VBO : public Buffer
|
class VBO : public Buffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline void create(uint32_t size, const char* name) { Buffer::create(Buffer::kind::dynamic, size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, name); }
|
inline void create(uint32_t size, const char* name) { Buffer::create(Buffer::kind::dynamic, size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, name); }
|
||||||
@@ -27,7 +27,7 @@ namespace mlx
|
|||||||
inline void bind(Renderer& renderer) noexcept { vkCmdBindVertexBuffers(renderer.getActiveCmdBuffer().get(), 0, 1, &_buffer, &_offset); }
|
inline void bind(Renderer& renderer) noexcept { vkCmdBindVertexBuffers(renderer.getActiveCmdBuffer().get(), 0, 1, &_buffer, &_offset); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class MLX_API C_VBO : public Buffer
|
class C_VBO : public Buffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline void create(uint32_t size, const void* data, const char* name) { Buffer::create(Buffer::kind::constant, size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, name, data); }
|
inline void create(uint32_t size, const void* data, const char* name) { Buffer::create(Buffer::kind::constant, size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, name, data); }
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API CmdManager
|
class CmdManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CmdManager() = default;
|
CmdManager() = default;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API CmdBuffer
|
class CmdBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init(class CmdManager* manager);
|
void init(class CmdManager* manager);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API CmdPool
|
class CmdPool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init();
|
void init();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API GPUallocator
|
class GPUallocator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GPUallocator() = default;
|
GPUallocator() = default;
|
||||||
|
|||||||
@@ -24,7 +24,11 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#warning "MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances"
|
#ifndef MLX_COMPILER_MSVC
|
||||||
|
#warning "MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances"
|
||||||
|
#else
|
||||||
|
#pragma NOTE("MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances")
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace mlx
|
|||||||
|
|
||||||
constexpr const int MAX_FRAMES_IN_FLIGHT = 3;
|
constexpr const int MAX_FRAMES_IN_FLIGHT = 3;
|
||||||
|
|
||||||
class MLX_API Render_Core : public Singleton<Render_Core>
|
class Render_Core : public Singleton<Render_Core>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Render_Core() = default;
|
Render_Core() = default;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API Device
|
class Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init();
|
void init();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API Fence
|
class Fence
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Fence() = default;
|
Fence() = default;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API Instance
|
class Instance
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init();
|
void init();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API Queues
|
class Queues
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct QueueFamilyIndices
|
struct QueueFamilyIndices
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API Semaphore
|
class Semaphore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init();
|
void init();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API Surface
|
class Surface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void create(class Renderer& renderer);
|
void create(class Renderer& renderer);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API ValidationLayers
|
class ValidationLayers
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init();
|
void init();
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API DescriptorPool
|
class DescriptorPool
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init(std::size_t n, VkDescriptorPoolSize* size);
|
void init(std::size_t n, VkDescriptorPoolSize* size);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API DescriptorSet
|
class DescriptorSet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init(class Renderer* renderer, class DescriptorPool* pool, class DescriptorSetLayout* layout);
|
void init(class Renderer* renderer, class DescriptorPool* pool, class DescriptorSetLayout* layout);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API DescriptorSetLayout
|
class DescriptorSetLayout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init(std::vector<std::pair<int, VkDescriptorType>> binds, VkShaderStageFlagBits stage);
|
void init(std::vector<std::pair<int, VkDescriptorType>> binds, VkShaderStageFlagBits stage);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API Texture : public Image
|
class Texture : public Image
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Texture() = default;
|
Texture() = default;
|
||||||
@@ -62,9 +62,9 @@ namespace mlx
|
|||||||
bool _has_been_updated = false;
|
bool _has_been_updated = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
MLX_API Texture stbTextureLoad(std::filesystem::path file, int* w, int* h);
|
Texture stbTextureLoad(std::filesystem::path file, int* w, int* h);
|
||||||
|
|
||||||
struct MLX_API TextureRenderData
|
struct TextureRenderData
|
||||||
{
|
{
|
||||||
Texture* texture;
|
Texture* texture;
|
||||||
std::size_t hash = 0;
|
std::size_t hash = 0;
|
||||||
@@ -79,7 +79,7 @@ namespace mlx
|
|||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
template <>
|
template <>
|
||||||
struct MLX_API hash<mlx::TextureRenderData>
|
struct hash<mlx::TextureRenderData>
|
||||||
{
|
{
|
||||||
size_t operator()(const mlx::TextureRenderData& td) const noexcept
|
size_t operator()(const mlx::TextureRenderData& td) const noexcept
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API TextureAtlas : public Image
|
class TextureAtlas : public Image
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TextureAtlas() = default;
|
TextureAtlas() = default;
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
MLX_API uint32_t formatSize(VkFormat format);
|
uint32_t formatSize(VkFormat format);
|
||||||
|
|
||||||
class MLX_API Image
|
class Image
|
||||||
{
|
{
|
||||||
friend class SwapChain;
|
friend class SwapChain;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API GraphicPipeline
|
class GraphicPipeline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init(class Renderer& renderer);
|
void init(class Renderer& renderer);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API PixelPutPipeline
|
class PixelPutPipeline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PixelPutPipeline() = default;
|
PixelPutPipeline() = default;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
struct MLX_API Vertex
|
struct Vertex
|
||||||
{
|
{
|
||||||
glm::vec2 pos;
|
glm::vec2 pos;
|
||||||
glm::vec4 color;
|
glm::vec4 color;
|
||||||
@@ -78,7 +78,7 @@ namespace mlx
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MLX_API Renderer
|
class Renderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Renderer() = default;
|
Renderer() = default;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API FrameBuffer
|
class FrameBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init(class RenderPass& renderpass, class Image& image);
|
void init(class RenderPass& renderpass, class Image& image);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API RenderPass
|
class RenderPass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init(VkFormat attachement_format);
|
void init(VkFormat attachement_format);
|
||||||
|
|||||||
@@ -20,14 +20,14 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API SwapChain
|
class SwapChain
|
||||||
{
|
{
|
||||||
friend class GraphicPipeline;
|
friend class GraphicPipeline;
|
||||||
friend class RenderPass;
|
friend class RenderPass;
|
||||||
friend class Renderer;
|
friend class Renderer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct MLX_API SwapChainSupportDetails
|
struct SwapChainSupportDetails
|
||||||
{
|
{
|
||||||
VkSurfaceCapabilitiesKHR capabilities;
|
VkSurfaceCapabilitiesKHR capabilities;
|
||||||
std::vector<VkSurfaceFormatKHR> formats;
|
std::vector<VkSurfaceFormatKHR> formats;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace mlx
|
|||||||
using TextID = uint32_t;
|
using TextID = uint32_t;
|
||||||
constexpr TextID nulltext = 0;
|
constexpr TextID nulltext = 0;
|
||||||
|
|
||||||
class MLX_API TextData
|
class TextData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TextData() = default;
|
TextData() = default;
|
||||||
@@ -46,7 +46,7 @@ namespace mlx
|
|||||||
std::string _text;
|
std::string _text;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MLX_API TextLibrary
|
class TextLibrary
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TextLibrary() = default;
|
TextLibrary() = default;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
struct MLX_API TextDrawData
|
struct TextDrawData
|
||||||
{
|
{
|
||||||
TextID id;
|
TextID id;
|
||||||
int x;
|
int x;
|
||||||
@@ -41,7 +41,7 @@ namespace mlx
|
|||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
template <>
|
template <>
|
||||||
struct MLX_API hash<mlx::TextDrawData>
|
struct hash<mlx::TextDrawData>
|
||||||
{
|
{
|
||||||
std::size_t operator()(const mlx::TextDrawData& d) const noexcept
|
std::size_t operator()(const mlx::TextDrawData& d) const noexcept
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ namespace std
|
|||||||
|
|
||||||
namespace mlx
|
namespace mlx
|
||||||
{
|
{
|
||||||
class MLX_API TextPutPipeline
|
class TextPutPipeline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TextPutPipeline() = default;
|
TextPutPipeline() = default;
|
||||||
|
|||||||
BIN
test/Test.exe
git.filemode.normal_file
BIN
test/Test.exe
git.filemode.normal_file
Binary file not shown.
Reference in New Issue
Block a user