Basic tests and trying to fix address sanitizer errors
This commit is contained in:
3
build.sh
3
build.sh
@@ -13,7 +13,8 @@ if [ ! -e "src/external/SDL" ]; then
|
|||||||
git clone https://github.com/libsdl-org/SDL.git
|
git clone https://github.com/libsdl-org/SDL.git
|
||||||
cd SDL
|
cd SDL
|
||||||
git checkout release-3.2.30
|
git checkout release-3.2.30
|
||||||
# cmake -S . -B build_linux -DCMAKE_BUILD_TYPE=Release -DSDL_PIPEWIRE=OFF
|
# We need older version of SDL3 because there is a bug on wayland that
|
||||||
|
# doubles click events and it's kind of unusable
|
||||||
cmake -S . -B build_linux -DSDL_PIPEWIRE=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
|
cmake -S . -B build_linux -DSDL_PIPEWIRE=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
|
||||||
cd build_linux
|
cd build_linux
|
||||||
sudo make -j16 install
|
sudo make -j16 install
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#if PLUGIN_TESTS
|
||||||
bool Testing = true;
|
bool Testing = true;
|
||||||
|
|
||||||
void Wait(mco_coro *co) {
|
void Wait(mco_coro *co) {
|
||||||
@@ -37,4 +38,19 @@ void CO_FirstTest(mco_coro *co) {
|
|||||||
{Event ev = {};ev.kind = EVENT_TEXT_INPUT; ev.xwindow = 1412; ev.ywindow = 1032; ev.xmouse = 1234; ev.ymouse = 594; ev.text = "f"; Add(&EventPlayback, ev);}
|
{Event ev = {};ev.kind = EVENT_TEXT_INPUT; ev.xwindow = 1412; ev.ywindow = 1032; ev.xmouse = 1234; ev.ymouse = 594; ev.text = "f"; Add(&EventPlayback, ev);}
|
||||||
Wait(co);
|
Wait(co);
|
||||||
|
|
||||||
|
String16 result = uR"FOO(
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Memes and stuff)FOO";
|
||||||
|
BSet set = GetBSet(PrimaryWindowID);
|
||||||
|
Assert(AreEqual(result, GetString(set.buffer)));
|
||||||
|
|
||||||
|
void CMD_QuitWithoutSaving();
|
||||||
|
CMD_QuitWithoutSaving();
|
||||||
|
|
||||||
} RegisterCoroutineCommand(CO_FirstTest, "", "Basic tests");
|
} RegisterCoroutineCommand(CO_FirstTest, "", "Basic tests");
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ Font CreateFont(Atlas *atlas, int32_t size, String path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stbtt_fontinfo stb_font;
|
stbtt_fontinfo stb_font;
|
||||||
int success = stbtt_InitFont(&stb_font, (const unsigned char *)file.data, 0);
|
int success = stbtt_InitFont(&stb_font, (const unsigned char *)file.data, 0);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,22 +18,20 @@ struct VertexList2D {
|
|||||||
|
|
||||||
struct Shader {
|
struct Shader {
|
||||||
GLuint program; // linked program (vertex+fragment)
|
GLuint program; // linked program (vertex+fragment)
|
||||||
GLint uni_invHalf; // uniform location for inv half-screen size
|
GLint uni_invHalf; // uniform location for inv half-screen size
|
||||||
GLint uni_texture; // sampler location
|
GLint uni_texture; // sampler location
|
||||||
};
|
};
|
||||||
|
|
||||||
VertexList2D Vertices;
|
VertexList2D Vertices;
|
||||||
int64_t TotalVertexCount;
|
int64_t TotalVertexCount;
|
||||||
|
|
||||||
unsigned VBO, VAO;
|
unsigned VBO, VAO;
|
||||||
Shader Shader2D;
|
Shader Shader2D;
|
||||||
BlockArena RenderArena;
|
BlockArena RenderArena;
|
||||||
Rect2 CurrentScissor;
|
Rect2 CurrentScissor;
|
||||||
|
|
||||||
Font PrimaryFont;
|
Font PrimaryFont;
|
||||||
Font SecondaryFont;
|
|
||||||
|
|
||||||
// ---------- shaders (ES3 / WebGL2) ----------
|
|
||||||
static const char *glsl_vshader_es3 = R"==(#version 300 es
|
static const char *glsl_vshader_es3 = R"==(#version 300 es
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
@@ -82,7 +80,6 @@ void GLDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- helper: compile/link ----------
|
|
||||||
static GLuint CompileShaderSrc(GLenum kind, const char *src) {
|
static GLuint CompileShaderSrc(GLenum kind, const char *src) {
|
||||||
GLuint s = glCreateShader(kind);
|
GLuint s = glCreateShader(kind);
|
||||||
glShaderSource(s, 1, &src, NULL);
|
glShaderSource(s, 1, &src, NULL);
|
||||||
@@ -137,7 +134,6 @@ Shader CreateShaderES3(const char *vsrc, const char *fsrc) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- InitRender for ES3 ----------
|
|
||||||
void InitRender() {
|
void InitRender() {
|
||||||
#if !OS_WASM
|
#if !OS_WASM
|
||||||
glDebugMessageCallback(&GLDebugCallback, NULL);
|
glDebugMessageCallback(&GLDebugCallback, NULL);
|
||||||
@@ -185,7 +181,6 @@ void BeginFrameRender(float wx, float wy) {
|
|||||||
CurrentScissor = Rect0Size(wx, wy);
|
CurrentScissor = Rect0Size(wx, wy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- EndFrameRender for ES3 ----------
|
|
||||||
void EndFrameRender(float wx, float wy, Color color) {
|
void EndFrameRender(float wx, float wy, Color color) {
|
||||||
ProfileFunction();
|
ProfileFunction();
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
@@ -391,6 +386,9 @@ void ReloadFont(String path, U32 size) {
|
|||||||
Scratch scratch;
|
Scratch scratch;
|
||||||
Atlas atlas = CreateAtlas(scratch, {2048, 2048});
|
Atlas atlas = CreateAtlas(scratch, {2048, 2048});
|
||||||
PrimaryFont = CreateFont(&atlas, (uint32_t)ClampBottom(2u, (U32)size), path);
|
PrimaryFont = CreateFont(&atlas, (uint32_t)ClampBottom(2u, (U32)size), path);
|
||||||
SecondaryFont = CreateFont(&atlas, 12, path);
|
PrimaryFont.texture_id = UploadAtlas(&atlas);
|
||||||
SecondaryFont.texture_id = PrimaryFont.texture_id = UploadAtlas(&atlas);
|
}
|
||||||
|
|
||||||
|
void CleanupRender() {
|
||||||
|
Dealloc(&PrimaryFont.glyphs);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
|
- [ ] Switch fully to VSCode keybindings and learn to live with it
|
||||||
- [x] list_functions.sh and rg in general in the color mode is prinitng differently from terminal as well as output is truncated!
|
- [x] list_functions.sh and rg in general in the color mode is prinitng differently from terminal as well as output is truncated!
|
||||||
- [ ] Syntax for executing commands from root of project
|
- [ ] Syntax for executing commands from root of project, or maybe commands should be executed from root of the CurrentDirectory and there should be a cd command instead of OpenProject
|
||||||
- [ ] Fuzzy search over executed command ouput
|
- [ ] Fuzzy search over executed command ouput
|
||||||
- [ ] When inserting parenthesis and selection is there, put the parens on both sides?
|
- [ ] When inserting parenthesis and selection is there, put the parens on both sides?
|
||||||
- [ ] KillProcess in console !!! - should also kill all the children ...........
|
- [ ] KillProcess in console !!! - should also kill all the children ...........
|
||||||
@@ -13,6 +14,10 @@
|
|||||||
- [x] BRO, the caret teleports on linux when I press the arrow for too long
|
- [x] BRO, the caret teleports on linux when I press the arrow for too long
|
||||||
- [ ] Report SDL newest vs SDL previous version on wayland
|
- [ ] Report SDL newest vs SDL previous version on wayland
|
||||||
|
|
||||||
|
- [ ] Ctrl+Shift+ArrowDown at the end of buffer, doesn't capture characters on last line without new line
|
||||||
|
- [ ] Remove -lbacktrace and add my backtrace library thing
|
||||||
|
- [ ] Refactor build.sh to accept commands and remove build_web.sh
|
||||||
|
|
||||||
- [ ] Cleanups
|
- [ ] Cleanups
|
||||||
- [ ] How to enable framerate to be unlimited and not break scrolling?
|
- [ ] How to enable framerate to be unlimited and not break scrolling?
|
||||||
- [x] When dragging a file into the editor, would be nice if the file opened in the window user dropped the file into. Not the active window.
|
- [x] When dragging a file into the editor, would be nice if the file opened in the window user dropped the file into. Not the active window.
|
||||||
@@ -91,6 +96,7 @@
|
|||||||
#define PLUGIN_REMEDYBG OS_WINDOWS
|
#define PLUGIN_REMEDYBG OS_WINDOWS
|
||||||
#define PLUGIN_FILE_COMMANDS 1
|
#define PLUGIN_FILE_COMMANDS 1
|
||||||
#define PLUGIN_WORD_COMPLETE 1
|
#define PLUGIN_WORD_COMPLETE 1
|
||||||
|
#define PLUGIN_TESTS 1
|
||||||
|
|
||||||
#include "plugin_directory_navigation.h"
|
#include "plugin_directory_navigation.h"
|
||||||
#include "plugin_search_window.h"
|
#include "plugin_search_window.h"
|
||||||
@@ -153,17 +159,16 @@ void SetMouseCursor(SDL_SystemCursor id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
SDL_Cursor *SDL_MouseCursor;
|
||||||
|
SDL_SystemCursor SDL_MouseCursorLastID;
|
||||||
void SetMouseCursor(SDL_SystemCursor id) {
|
void SetMouseCursor(SDL_SystemCursor id) {
|
||||||
static SDL_Cursor *SDL_MouseCursor;
|
if (SDL_MouseCursor == NULL || SDL_MouseCursorLastID != id) {
|
||||||
static SDL_SystemCursor last_id;
|
|
||||||
|
|
||||||
if (SDL_MouseCursor == NULL || last_id != id) {
|
|
||||||
if (SDL_MouseCursor != NULL) {
|
if (SDL_MouseCursor != NULL) {
|
||||||
SDL_DestroyCursor(SDL_MouseCursor);
|
SDL_DestroyCursor(SDL_MouseCursor);
|
||||||
}
|
}
|
||||||
SDL_MouseCursor = SDL_CreateSystemCursor(id);
|
SDL_MouseCursor = SDL_CreateSystemCursor(id);
|
||||||
SDL_SetCursor(SDL_MouseCursor);
|
SDL_SetCursor(SDL_MouseCursor);
|
||||||
last_id = id;
|
SDL_MouseCursorLastID = id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -216,9 +221,6 @@ void SetMouseCursor(Event event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CMD_QuitWithoutSaving() {
|
void CMD_QuitWithoutSaving() {
|
||||||
#if PLUGIN_REMEDYBG
|
|
||||||
QuitDebugger();
|
|
||||||
#endif
|
|
||||||
AppIsRunning = false;
|
AppIsRunning = false;
|
||||||
} RegisterCommand(CMD_QuitWithoutSaving, "", "Self explanatory");
|
} RegisterCommand(CMD_QuitWithoutSaving, "", "Self explanatory");
|
||||||
|
|
||||||
@@ -1136,6 +1138,12 @@ int main(int argc, char **argv, char **envp)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PLUGIN_REMEDYBG
|
||||||
|
QuitDebugger();
|
||||||
|
#endif
|
||||||
|
CleanupRender();
|
||||||
|
|
||||||
|
SDL_DestroyCursor(SDL_MouseCursor);
|
||||||
SDL_DestroyWindow(SDLWindow);
|
SDL_DestroyWindow(SDLWindow);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user