Git Product home page Git Product logo

gunslinger's People

Contributors

baguettifer avatar chukobyte avatar endeg avatar grinshpon avatar jdoleary avatar kenthjohan avatar laurirasanen avatar lukvargen avatar matthewgeorgy avatar mrfrenik avatar pegvin avatar quou avatar samdal avatar skarlett avatar sushilragoonath avatar tristanwagner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gunslinger's Issues

Syntax Error on line 325 of gs_audio.c

The line
gs_audio_instance_data_t data = {};
doesn't compile on Microsoft (R) C/C++ Optimizing Compiler Version 19.26.28805 for x64. It should be
gs_audio_instance_data_t data = {0};

Displays incorrectly when Windows user has a "Scale and layout" percentage size set that isn't "100%"

Expected: setting window_width to 400 and window_height to 400 should open a window of size 400 by 400
Actual: setting window_width to 400 and window_height to 400 opens a window of size 600 by 600
Note: Setting it to 800 by 800 opens with a size of 1200 by 1200. It appears the window is always 150% larger than specified

Minimum Reproducible Example

#define GS_IMPL
#include <gs/gs.h>

void init()
{
	gs_vec2 screenSize = gs_platform_window_sizev(gs_platform_main_window());
    gs_println("screen size: %f, %f", screenSize.x, screenSize.y);
}

void update()
{
    if (gs_platform_key_pressed(GS_KEYCODE_ESC)) gs_engine_quit();
}

gs_app_desc_t gs_main(int32_t argc, char** argv)
{
    return (gs_app_desc_t){
        .init = init,
        .window_width = 400,
        .window_height = 400,
        .update = update
    };
}   

Extra info that might be useful:

  • I have verified that the call to glfwCreateWindow receives the correct width and height.
  • _glfwPlatformGetWindowSize is the first time that I see the incorrect width and height. The area.right and bottom are incorrect.
  • Could this have something to do with my client machine specifically? I just started developing on a new machine and I don't remember encountering this issue while running other Gunslinger projects.

My machine:
OS Name Microsoft Windows 10 Pro
Processor Intel(R) Core(TM) i9-10850K CPU @ 3.60GHz, 3600 Mhz, 10 Core(s), 20 Logical Processor(s)
GPU NVIDIA GeForce GTX 1080 Ti

I'm compiling and running with proc\win\cl.bat && bin\App.exe


Update It appears that the problem occurs in win32_window.c _glfwPlatformGetWindowContentScale where xscale and yscale are each set to 1.5

VSync issue regression

The VSync issue fixed in #39 is still present in the current version of gs. Seems to have been added back in a commit few days after the PR: 6fdd889.

I have Question about uninitialized variable in gs_audio_impl.h

Hello, MrFrenik

I found something weird code to me.

when I tested your example code in 19_uniform_buffers

I had Compile Warning C4700 in gs_audio_impl.h 514, 515 line

                }

                s16 target_left_sample ;
                s16 target_right_sample ;

               .
               .
               .
                s16 left_sample = (s16)((((s64)start_left_sample + (s64)target_left_sample) / 2) * sample_volume);
                s16 right_sample = (s16)((((s64)start_right_sample + (s64)target_right_sample) / 2) * sample_volume);

that variables was not initialized. (yes when turn off that warning it worked well,)
my question is I wonder if that was your intention.

thank you for reading. 👍

My env is that,
OS : Windows 10
build : visual studio 19 community

Possible discussions tab

Would it be possible for you to enable the discussions tab currently rolling out under settings/features.I feel this may be productive for the project as it grows.

Uniform Arrays handling

There seems to be no wrapper around glUniformXv which handles uploading arrays of uniforms.
Currently, you have to have a bunch of uniforms which can get very tedious.

Cant Compile on Windows

When I compile with VS 2017 i see this:

*.c
*.c
*.c
*.c
*.c
*.c
*.c
*.c
c1: fatal error C1083: Cannot open source file: '..\source\serialize*.c': No such file or directory
c1: fatal error C1083: Cannot open source file: '..\source\graphics*.c': No such file or directory
c1: fatal error C1083: Cannot open source file: '..\source\base*.c': No such file or directory
c1: fatal error C1083: Cannot open source file: '..\source\platform\glfw*.c': No such file or directory
c1: fatal error C1083: Cannot open source file: '..\source\platform*.c': No such file or directory
c1: fatal error C1083: Cannot open source file: '..\source\audio*.c': No such file or directory
c1: fatal error C1083: Cannot open source file: '..\source\graphics\opengl*.c': No such file or directory
c1: fatal error C1083: Cannot open source file: '..\source\audio\miniaudio*.c': No such file or directory

Typo in readme: Linux build

Command is written:

From terminal, run bash ./proc/osx/compile_linux_gcc.sh

Should be:

From terminal, run bash ./proc/linux/compile_linux_gcc.sh

2D camera immediate GUI avoid flipping textures

Hello,

On 2D camera you have decided to set the origin at the top left of the screen which is fine (screen coordinates). Some comment in the code would be nice: set a screen coordinate system in pixel - i will open a separate token regarding dpi handling in windows.
Can you please store in gs_immediate_draw_t the fact that y axis is reversed and passing that info to the fragment shader in a new uniform ? That way the user does not have to do it on his side before hand. See pull request #31 for this proposed implementation.

Also:
GS_API_DECL void gsi_rect(gs_immediate_draw_t* gsi, float x0, float y0, float x1, float y1, uint8_t r, uint8_t g, uint8_t b, uint8_t a, gs_graphics_primitive_type type);

Should be (wrong variable names):
GS_API_DECL void gsi_rect(gs_immediate_draw_t* gsi, float l, float b, float r, float t, uint8_t r, uint8_t g, uint8_t b, uint8_t a, gs_graphics_primitive_type type);

Thanks !

Hash table iterator won't work with 64-bit keys.

I'm getting pretty strange behavior when trying to iterate gs_hash_table(u64, ...). But when I use u32 key it works normal. Here's the minimum program:

#define GS_IMPL
#define GS_NO_HIJACK_MAIN
#include <gs.h>

typedef struct SomeData {
    int value;
} SomeData;

int32_t main(int32_t argv, char** argc) {
    gs_println("Start");

    {
        gs_println("32-bit key:");

        gs_hash_table(u32, SomeData) ht = gs_hash_table_new(u32, SomeData);
        gs_hash_table_init(ht, u32, SomeData);

        gs_hash_table_insert(ht, gs_hash_str("d1"), (SomeData){.value = 32});
        gs_hash_table_insert(ht, gs_hash_str("d2"), (SomeData){.value = 42});
        gs_hash_table_insert(ht, gs_hash_str("d3"), (SomeData){.value = 0});
        gs_hash_table_insert(ht, gs_hash_str("d4"), (SomeData){.value = 1});

        gs_println("\tgs_hash_table_iter_new(ht) = %u", gs_hash_table_iter_new(ht));

        for (gs_hash_table_iter it = gs_hash_table_iter_new(ht);
            gs_hash_table_iter_valid(ht, it);
            gs_hash_table_iter_advance(ht, it)) {
                SomeData someData = gs_hash_table_iter_get(ht, it);
                u32 key = gs_hash_table_iter_get_key(ht, it);
                gs_println("\tit = %u, key = %u, value = %d", it, key, someData.value);
        }

        gs_println("Manual fetch:");
        gs_println("\tkey = %u, value = %d", gs_hash_str("d1"), gs_hash_table_get(ht, gs_hash_str("d1")).value);
        gs_println("\tkey = %u, value = %d", gs_hash_str("d2"), gs_hash_table_get(ht, gs_hash_str("d2")).value);
        gs_println("\tkey = %u, value = %d", gs_hash_str("d3"), gs_hash_table_get(ht, gs_hash_str("d3")).value);
        gs_println("\tkey = %u, value = %d", gs_hash_str("d4"), gs_hash_table_get(ht, gs_hash_str("d4")).value);

        gs_hash_table_free(ht);
    }

    {
        gs_println("64-bit key:");

        gs_hash_table(u64, SomeData) ht = gs_hash_table_new(u64, SomeData);
        gs_hash_table_init(ht, u64, SomeData);

        gs_hash_table_insert(ht, gs_hash_str64("d1"), (SomeData){.value = 32});
        gs_hash_table_insert(ht, gs_hash_str64("d2"), (SomeData){.value = 42});
        gs_hash_table_insert(ht, gs_hash_str64("d3"), (SomeData){.value = 0});
        gs_hash_table_insert(ht, gs_hash_str64("d4"), (SomeData){.value = 1});

        gs_println("\tgs_hash_table_iter_new(ht) = %u", gs_hash_table_iter_new(ht));

        for (gs_hash_table_iter it = gs_hash_table_iter_new(ht);
            gs_hash_table_iter_valid(ht, it);
            gs_hash_table_iter_advance(ht, it)) {
                SomeData someData = gs_hash_table_iter_get(ht, it);
                u64 key = gs_hash_table_iter_get_key(ht, it);
                gs_println("\tit = %u, key = %u, value = %d", it, key, someData.value);
        }

        gs_println("Manual fetch:");
        gs_println("\tkey = %u, value = %d", gs_hash_str64("d1"), gs_hash_table_get(ht, gs_hash_str64("d1")).value);
        gs_println("\tkey = %u, value = %d", gs_hash_str64("d2"), gs_hash_table_get(ht, gs_hash_str64("d2")).value);
        gs_println("\tkey = %u, value = %d", gs_hash_str64("d3"), gs_hash_table_get(ht, gs_hash_str64("d3")).value);
        gs_println("\tkey = %u, value = %d", gs_hash_str64("d4"), gs_hash_table_get(ht, gs_hash_str64("d4")).value);

        gs_hash_table_free(ht);
    }

    gs_println("Finish");
    return 0;
}

And get following output on x64 build:

Start
32-bit key:
	gs_hash_table_iter_new(ht) = 0
	it = 0, key = 5863258, value = 32
	it = 3, key = 5863259, value = 42
	it = 6, key = 5863260, value = 0
	it = 7, key = 5863261, value = 1
Manual fetch:
	key = 5863258, value = 32
	key = 5863259, value = 42
	key = 5863260, value = 0
	key = 5863261, value = 1
64-bit key:
	gs_hash_table_iter_new(ht) = 8
Manual fetch:
	key = 2582833618, value = 32
	key = 2582452721, value = 42
	key = 2582579472, value = 0
	key = 2582198583, value = 1
Finish

And on x86 build:

Start
32-bit key:
	gs_hash_table_iter_new(ht) = 0
	it = 0, key = 5863258, value = 32
	it = 3, key = 5863259, value = 42
	it = 6, key = 5863260, value = 0
	it = 7, key = 5863261, value = 1
Manual fetch:
	key = 5863258, value = 32
	key = 5863259, value = 42
	key = 5863260, value = 0
	key = 5863261, value = 1
64-bit key:
	gs_hash_table_iter_new(ht) = 4
	it = 4, key = 0, value = 5863260
Manual fetch:
	key = 2582833618, value = 32
	key = 2582452721, value = 42
	key = 2582579472, value = 0
	key = 2582198583, value = 1
Finish

Used MSVS and release compile flags from examples. Hope this will give some info on what might be wrong.

Gunslinger does not compile on windows (MSVC 2019)

Specifically, The gs_graphics.c file. I get a syntax error of missing a semicolon

image

But the lib file does get generated without the symbols from the gs_graphics file. When I tried to compile an example with the Built lib, I get many unresolved symbol errors

image

I guess there is no obj generated for gs_graphics.c either

image

gs_audio: Use-after-free crash on exit

Gunslinger apps occasionally segfault when closing. It's not really a big deal since the program is already exiting, but I know users in the Discord have mentioned it before so I thought it should be officially reported.

Tested on Linux w/ GCC.

Address Sanitizer says this crash happens when ma_audio_commit accesses the audio subsystem after the engine instance has been freed.

for (
gs_slot_array_iter it = gs_slot_array_iter_new(audio->instances);
gs_slot_array_iter_valid(audio->instances, it);
gs_slot_array_iter_advance(audio->instances, it)
)

// Free engine
gs_free(inst);

GDB backtrace:

#0  0x00005555555699fe in ma_audio_commit (device=<optimized out>, output=0x7fffe465edc0, input=<optimized out>, frame_count=440) at ../../third_party/include/gs/impl/gs_audio_impl.h:449
#1  0x000055555564d430 in ma_device__on_data (pDevice=pDevice@entry=0x555555c189d0, pFramesOut=pFramesOut@entry=0x7fffe465edc0, pFramesIn=pFramesIn@entry=0x0, frameCount=frameCount@entry=440)
    at ../../third_party/include/gs/impl/../external/miniaudio/miniaudio.h:9948
#2  0x000055555565ee3f in ma_device__read_frames_from_client (pFramesOut=0x7fffe465edc0, frameCount=440, pDevice=0x555555c189d0) at ../../third_party/include/gs/impl/../external/miniaudio/miniaudio.h:9976
#3  ma_device_main_loop__pulse (pDevice=0x555555c189d0) at ../../third_party/include/gs/impl/../external/miniaudio/miniaudio.h:21417
#4  0x0000555555578e00 in ma_worker_thread (pData=0x555555c189d0) at ../../third_party/include/gs/impl/../external/miniaudio/miniaudio.h:30577
#5  0x00007ffff7c72299 in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007ffff7b99053 in clone () from /usr/lib/libc.so.6

Relevant address sanitizer output:

=================================================================
==6555==ERROR: AddressSanitizer: heap-use-after-free on address 0x608000000030 at pc 0x55978997b005 bp 0x7fbcffe47050 sp 0x7fbcffe47040
READ of size 8 at 0x608000000030 thread T1
    #0 0x55978997b004 in ma_audio_commit ../../third_party/include/gs/impl/gs_audio_impl.h:433
    #1 0x559789b8fece in ma_device__on_data ../../third_party/include/gs/impl/../external/miniaudio/miniaudio.h:9948
    #2 0x559789bbd489 in ma_device__read_frames_from_client ../../third_party/include/gs/impl/../external/miniaudio/miniaudio.h:9976
    #3 0x559789bbd489 in ma_device_main_loop__pulse ../../third_party/include/gs/impl/../external/miniaudio/miniaudio.h:21417
=================================================================
0x608000000030 is located 16 bytes inside of 96-byte region [0x608000000020,0x608000000080)
freed by thread T0 here:
Direct leak of 270387 byte(s) in 59 object(s) allocated from:
    #0 0x7fbd0b49a0e9 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:123
    #1 0x55978995f3ff in main ../../third_party/include/gs/impl/gs_platform_impl.h:1398
    #0 0x7fbd0b49a639 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154

    #1 0x7fbd05cff9e3  (/usr/lib/libnvidia-glcore.so.460.56+0xd739e3)

resource update before command buffer submit

Currently the only way to update resources after creation is to submit them to command buffer,It would be nice to do them on the spot without any command buffer since it would be more performant to do the update while resources are loaded in on the cpu.

add GS_GUI_OPT_BRINGTOFRONT

Instead of needing to manually set the container — if you want a pop-up for example, you could set an opt instead.

This would in part do the same as
GS_API_DECL void gs_gui_bring_to_front(gs_gui_context_t *ctx, gs_gui_container_t *cnt);

Storage space of 'st' is unknown

Hey, I came across your framework from watching your sand simulation video. I have downloaded it and tried to compile on Ubuntu 16.04 and this line:

struct state st;

Gets the error Storage space of 'st' is unknown. I have grepped for a state struct but I couldn't find any.

Also, the line below it:

state( file_path, &st );

gives this warning implicit declartion of function 'state'. Ive looked in the <sys/stat.h> header and wonder if the state function should actually be the stat function from that header? Changing it to stat removes this warning and the library is built for me.

I'm not massively experienced with C programming so that could all be completely wrong and deliberate so ignore/close this issue if tha's the case. If not, I'm happy to send a pull request fixing it.

Thanks for making the video btw. It was incredibly informative and helpful for building my own simulation!

Visual Studio Error "Uninitialized local variable 'decl'" in gs_audio_impl.h

Exactly what the title says
Error C4700 uninitialized local variable 'decl' used *\gs\impl\gs_audio_impl.h on line 284 in function "gs_audio_get_instance_data()"
I'm not very experienced in C programming, and trying the fix Visual Studio recommended didn't fix the issue.
Thanks!
System information

  • OS: [Windows 10]
  • Compiler: [Visual Studio 2022]

crash when loading gLTF model with multiple meshes

The crash happens at gs.h:7000 listed below:

bool gs_util_load_gltf_data_from_file(const char* path, gs_asset_mesh_decl_t* decl, gs_asset_mesh_raw_data_t** out, uint32_t* mesh_count)
{
   // ...

    // Allocate memory for buffers
    *mesh_count = data->meshes_count;
    *out = (gs_asset_mesh_raw_data_t*)gs_malloc(data->meshes_count * sizeof(gs_asset_mesh_raw_data_t));
    memset(*out, 0, sizeof(gs_asset_mesh_raw_data_t) * data->meshes_count);

    // Iterate through meshes in data
    for (uint32_t i = 0; i < data->meshes_count; ++i)
    {
        // Initialize mesh data
        gs_asset_mesh_raw_data_t* mesh = out[i];
        mesh->prim_count = data->meshes[i].primitives_count; // (Crash)
   // ...

Exception thrown: read access violation.
**mesh** was 0xFFFFFFFFFFFFFFFF.

This gLTF model should reproduce it.

Maybe there's something wrong with out's pointer-fu or allocation? In the debugger it seems that out[1] and above contain garbage data. Only out[0] shows proper data and that would explain why is it working with this model or the included duck one.

Scaling issue with fullscreen window flag

The scaling of my linux computer goes very high after starting a window with fullscreen flag (endeavour os with i3wm (x11))
The code i used:

#define GS_IMPL
#include "gs.h"

gs_app_desc_t gs_main(int32_t argc, char** argv) {
  return (gs_app_desc_t) {
    .window_width = 1280,
    .window_height = 720,
    .window_flags = GS_WINDOW_FLAGS_FULLSCREEN
  };
}

image
How it is supposed to be:
image

Use cmake?

Have you considered using CMake to manage builds? The proc/ scripts seem to duplicate a lot of stuff and don't work well out of the box...

gs_println() giving incorrect results

Formatting is incorrect and not mapping data correctly to output. This was seen in the issue with the hash table giving "incorrect" results when being iterated over and displayed.

Compile error with gcc, on macos 10.12.

System

OS: MacOS 10.12

Issue

There is a Compile error with miniaudio.h while compiling with gcc.

using: https://github.com/MrFrenik/gs_examples/tree/main/22_first_person_camera

>>> gcc main.c -framework CoreFoundation -framework CoreVideo -framework IOKit -framework Cocoa -framework Carbon -framework CoreAudio -lglfw3

Here is the error, since its too big to post here.

The problem stems from the miniaudio.h with the macos' audio framework.

...
In file included from /System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h:19,
                 from /Users/zak/.local/include/gunslinger/external/miniaudio/miniaudio.h:22393,
                 from /Users/zak/.local/include/gunslinger/impl/gs_audio_impl.h:415, 
                 from /Users/zak/.local/include/gunslinger/gs.h:5950,
                 from main.c:17:
...

GCC

>>> gcc -v                                                                                                                                                           
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin16/10.2.0/lto-wrapper
Target: x86_64-apple-darwin16
Configured with: /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc10/gcc10/work/gcc-10.2.0/configure --prefix=/opt/local --build=x86_64-apple-darwin16 --enable-languages=c,c++,objc,obj-c++,lto,fortran,jit --libdir=/opt/local/lib/gcc10 --includedir=/opt/local/include/gcc10 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-10 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-10 --with-gxx-include-dir=/opt/local/include/gcc10/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-build-config=bootstrap-debug --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --enable-host-shared --disable-tls --with-pkgversion='MacPorts gcc10 10.2.0_5'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.0 (MacPorts gcc10 10.2.0_5)

Using Clang

Using clang however, it works as intended

>>> clang-mp-13 -v                                                                                                                                                   
clang version 13.0.0
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-13/bin
>>> clang-mp-13 main.c -framework CoreFoundation -framework CoreVideo -framework IOKit -framework Cocoa -framework Carbon -framework CoreAudio -lglfw3

I have also tried with different versions of clang, 10, 9 it works the same.

Screen Shot 2022-01-24 at 17 57 15

GSH Template project Linux shell script error: line 2: $'\r': command not found

The bash script in the template project ./proc/linux/compile_linux_gcc.sh needs to have Unix style line endings '\n' to execute, otherwise wherever there's an 'r' it will return the error "line 2: $'\r': command not found"

Can be fixed, by using the 'dos2unix' command line utility or by resaving the file with Unix file endings.

DPI management impact in immediate draw

Hello
In Windows, glfw will give: glfwGetWindowSize = glfwGetFramebufferSize, even if glfwGetWindowContentScale is not 1.

On other os you can indeed have glfwGetWindowSize = glfwGetFramebufferSize / glfwGetWindowContentScale like your are doing in void gs_platform_framebuffer_size(uint32_t handle, uint32_t* w, uint32_t* h)

So in Windows this is what happens when I ask with a Windows 150% scale factor:
gs_app_desc_t{
.window_width = 800,
.window_height = 600}
glfw creates a 1200x900 pixel window, this is fine
I draw an immediate 10 pixel square. It measures on screen 15 pixel in Windows. It will measure 10pixel on mac os x i suppose.
immediate set OpenGL viewport based on gs_platform_framebuffer_size which in windows will give me a viewport of 1800x900 exlaining the zoom of my square.

Question : should the user handle dpi on his side ?

If yes you should just call glfwGetFramebufferSize in gs_platform_framebuffer_size. For Camera2D maybe you need to call the framebuffer size instead of the window size (you need to think of all gs_platform_window_size calls).

One last thing : can you please add the glfw window create hint GLFW_SCALE_TO_MONITOR as a gs window option like GLFW_RESIZABLE ?

static lib failing on linux

trying to build a static lib

../../third_party/include/gs/impl/../external/glfw/posix_time.c:50:23: error: ‘CLOCK_MONOTONIC’ undeclared (first use in this function)                                                                              
   50 |     if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)                                                                                                                                                            

Got this error, on an arch distro.

MacOs assertion failed while shutdown

Describe the bug
Crashing while shutdown

Initializing GLFW
LOG::../third_party/include/gs/impl/gs_platform_impl.h::gs_platform_window_create_internal(1767)::OpenGL Version: 4.1 Metal - 83.1
Capture Device Count: 2
0: C-1U
1: Microphone MacBook Pro
Assertion failed: (g_ppTrackedDevices_CoreAudio == ((void*)0)), function ma_context__uninit_device_tracking__coreaudio, file miniaudio.h, line 24215.
fish: Job 1, './bin/App' terminated by signal SIGABRT (Abort)

Expected behavior
Should gracefully shutdown

System information (please complete the following information):

  • OS: [MacOs Ventura 13.4, Apple M1]
  • Compiler: [Apple clang version 14.0.3]

Additional context
Should ma_context_uninit be after ma_device_uninit?
in gs_audio_impl.h?

gs_result gs_audio_shutdown(gs_audio_t* audio)
{
    miniaudio_data_t* ma = (miniaudio_data_t*)audio->user_data; 

    ma_context_uninit(&ma->context);
    ma_device_uninit(&ma->device);
    ma_mutex_uninit(&ma->lock);
    
    return GS_RESULT_SUCCESS;
}

Usage of non C99 features

For example:

typedef struct 
{
    union 
    {
        f32 xy[2];
        struct 
        {
            f32 x, y;
        };
    };
} gs_vec2;

This would not compile on a compiler only supporting C99 without extensions. When compiling with -pedantic -std=c99 flags it would yield: warning: anonymous unions are a C11 extension [-Wc11-extensions]... Using anonymous unions and structs is not supported in C99 standard. It was introduced in C11 standard.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.