From 1b0a350850bb4a6e57446314e1682b8ec645ffe2 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sat, 9 Dec 2023 23:04:14 +0700 Subject: [PATCH 1/6] Fix typos. --- CHANGELOG.md | 2 +- sokol_app.h | 4 ++-- sokol_args.h | 2 +- sokol_log.h | 2 +- util/sokol_spine.h | 10 +++++----- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac87df7bc..14e4d9039 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -329,7 +329,7 @@ The main topic of this update is to separate sampler state from image state in sokol_gfx.h which became possible after GLES2 support had been removed from sokol_gfx.h. -This also causes some 'colateral changes' in shader authoring and +This also causes some 'collateral changes' in shader authoring and other sokol headers, but there was opportunity to fill a few feature gaps in sokol_gfx.h as well: diff --git a/sokol_app.h b/sokol_app.h index 342b538d9..1782b97d5 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -767,7 +767,7 @@ A `programmatic quit` initiated by calling sapp_quit() or sapp_request_quit() will work as described above: the cleanup callback is called, platform-specific cleanup is performed (on the web - this means that JS event handlers are unregisters), and then + this means that JS event handlers are unregistered), and then the request-animation-loop will be exited. However that's all. The web page itself will continue to exist (e.g. it's not possible to programmatically close the browser tab). @@ -926,7 +926,7 @@ append a new favicon link element, but not delete any manually defined favicon in the page - For an example and test of the window icon feature, check out the the + For an example and test of the window icon feature, check out the 'icon-sapp' sample on the sokol-samples git repository. ONSCREEN KEYBOARD diff --git a/sokol_args.h b/sokol_args.h index bce6bbad7..6c560baea 100644 --- a/sokol_args.h +++ b/sokol_args.h @@ -33,7 +33,7 @@ sokol_args.h provides a simple unified argument parsing API for WebAssembly and native apps. - When running as WebAssembly app, arguments are taken from the page URL: + When running as a WebAssembly app, arguments are taken from the page URL: https://floooh.github.io/tiny8bit/kc85.html?type=kc85_3&mod=m022&snapshot=kc85/jungle.kcc diff --git a/sokol_log.h b/sokol_log.h index 87f78d751..58ff30bf3 100644 --- a/sokol_log.h +++ b/sokol_log.h @@ -122,7 +122,7 @@ extern "C" { #endif /* - Plug this function into the 'logger.func' struct item when initializating any of the sokol + Plug this function into the 'logger.func' struct item when initializing any of the sokol headers. For instance for sokol_audio.h it would loom like this: saudio_setup(&(saudio_desc){ diff --git a/util/sokol_spine.h b/util/sokol_spine.h index 12203bcd4..48295a20e 100644 --- a/util/sokol_spine.h +++ b/util/sokol_spine.h @@ -126,7 +126,7 @@ ========================== During initialization: - - call sspine_setup() after initializating sokol-gfx + - call sspine_setup() after initializing sokol-gfx - create an atlas object from a Spine atlas file with sspine_make_atlas() - load and initialize the sokol-gfx image objects referenced by the atlas - create a skeleton object from a Spine skeleton file with sspine_make_skeleton() @@ -424,7 +424,7 @@ sspine_shutdown(); sg_shutdown(); - - You can explicitely destroy the base object types if you don't need them + - You can explicitly destroy the base object types if you don't need them any longer. This will cause the underlying spine-c objects to be freed and the memory to be returned to the operating system: @@ -578,10 +578,10 @@ - sspine_context_draw_layer_in_instance(ctx, ...) - sspine_context_draw_layer(ctx, ...) - These explicitely take a context argument, completely ignore + These explicitly take a context argument, completely ignore and don't change the active context. - You can query some information about the a context with the function: + You can query some information about a context with the function: sspine_context_info info = ssgpine_get_context_info(ctx); @@ -604,7 +604,7 @@ - SSPINE_RESOURCE_VALID: the object is valid and ready to use - SSPINE_RESOURCE_FAILED: the object creation has failed - SSPINE_RESOURCE_INVALID: the object or one of its dependencies is - invalid, it either no longer exists, or the the handle hasn't been + invalid, it either no longer exists, or the handle hasn't been initialized with a call to one of the object creation functions MISC HELPER FUNCTIONS: From 9fc55c6809a1b82ff69734483163d66ca72b024f Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sat, 9 Dec 2023 23:17:14 +0700 Subject: [PATCH 2/6] ci: Update to `actions/checkout@v4` from `v3`. --- .github/workflows/gen_bindings.yml | 32 +++++++++++++++--------------- .github/workflows/main.yml | 12 +++++------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/gen_bindings.yml b/.github/workflows/gen_bindings.yml index 5d39900f6..9764ffc7c 100644 --- a/.github/workflows/gen_bindings.yml +++ b/.github/workflows/gen_bindings.yml @@ -6,7 +6,7 @@ jobs: test-windows: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: test_win run: | cd tests @@ -16,7 +16,7 @@ jobs: test-mac: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: seanmiddleditch/gha-setup-ninja@master - name: test_macos run: | @@ -26,7 +26,7 @@ jobs: test-linux: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: seanmiddleditch/gha-setup-ninja@master - name: prepare run: | @@ -41,20 +41,20 @@ jobs: needs: [ test-windows, test-mac, test-linux ] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - uses: actions/checkout@v4 with: repository: floooh/sokol-zig path: bindgen/sokol-zig - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: floooh/sokol-nim path: bindgen/sokol-nim - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: floooh/sokol-odin path: bindgen/sokol-odin - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: floooh/sokol-rust path: bindgen/sokol-rust @@ -96,7 +96,7 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: floooh/sokol-zig - uses: goto-bus-stop/setup-zig@v2 @@ -127,7 +127,7 @@ jobs: with: nim-version: devel repo-token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: floooh/sokol-nim - uses: actions/download-artifact@v3 @@ -155,7 +155,7 @@ jobs: os: [ubuntu-latest, windows-latest] runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: floooh/sokol-odin - uses: actions/download-artifact@v3 @@ -220,7 +220,7 @@ jobs: os: [ubuntu-latest, windows-latest] runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: floooh/sokol-rust submodules: recursive @@ -247,7 +247,7 @@ jobs: if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: floooh/sokol-zig ssh-key: ${{ secrets.GHACTIONS_ZIG_PUSH }} @@ -268,7 +268,7 @@ jobs: if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: floooh/sokol-nim ssh-key: ${{ secrets.GHACTIONS_NIM_PUSH }} @@ -289,7 +289,7 @@ jobs: if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: floooh/sokol-odin ssh-key: ${{ secrets.GHACTIONS_ODIN_PUSH }} @@ -311,7 +311,7 @@ jobs: if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: floooh/sokol-rust ssh-key: ${{ secrets.GHACTIONS_RUST_PUSH }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c06f3685d..4d7ddf393 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ jobs: windows: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: test_win run: | cd tests @@ -15,7 +15,7 @@ jobs: mac: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: seanmiddleditch/gha-setup-ninja@master - name: test_macos run: | @@ -24,7 +24,7 @@ jobs: ios: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: test_ios run: | cd tests @@ -32,7 +32,7 @@ jobs: linux: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: seanmiddleditch/gha-setup-ninja@master - name: prepare run: | @@ -45,7 +45,7 @@ jobs: emscripten: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: seanmiddleditch/gha-setup-ninja@master - name: test_emscripten run: | @@ -54,7 +54,7 @@ jobs: android: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: seanmiddleditch/gha-setup-ninja@master - uses: actions/setup-java@v1 with: From 66739fd6422b424607fb0d8166647afdf0aaac7c Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sat, 9 Dec 2023 23:29:58 +0700 Subject: [PATCH 3/6] rust: Fix manual_slice_size_calculation lint. See: https://rust-lang.github.io/rust-clippy/master/index.html#/manual_slice_size_calculation --- bindgen/gen_rust.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindgen/gen_rust.py b/bindgen/gen_rust.py index 0b6384c45..9349152be 100644 --- a/bindgen/gen_rust.py +++ b/bindgen/gen_rust.py @@ -766,7 +766,7 @@ def gen_helpers(inp): if inp['prefix'] in ['sg_', 'sdtx_', 'sshape_', 'sapp_']: l("/// Helper function to cast a rust slice into a sokol Range") l(f"pub fn slice_as_range(data: &[T]) -> {range_struct_name} {{") - l(f" {range_struct_name} {{ size: data.len() * std::mem::size_of::(), ptr: data.as_ptr() as *const _ }}") + l(f" {range_struct_name} {{ size: std::mem::size_of_val(data), ptr: data.as_ptr() as *const _ }}") l("}") l("/// Helper function to cast a rust reference into a sokol Range") l(f"pub fn value_as_range(value: &T) -> {range_struct_name} {{") From 81899f987c323c76324d0882cb076944acdaaa45 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sun, 10 Dec 2023 14:33:21 +0100 Subject: [PATCH 4/6] bindings: add a reminder to bindgen/README.md about preserving comments --- bindgen/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bindgen/README.md b/bindgen/README.md index 0b9b69648..aef1ec179 100644 --- a/bindgen/README.md +++ b/bindgen/README.md @@ -1,5 +1,7 @@ ## Language Binding Generation Scripts +> REMINDER: we can pass `-fparse-all-comments` to the clang ast-dump command line which adds the following node types to the ast-dump.json: FullComment, ParagraphComment, TextComment. This might allow us to preserve comments in the language bindings (might be useful as part of a bigger change to make sokol header comments autodoc and Intellisense-friendly) + ### Zig First make sure that clang and python3 are in the path: From 074d0fb2211355291339b1dc6dd13987e23c7e58 Mon Sep 17 00:00:00 2001 From: Valentyn Ivanov Date: Tue, 26 Dec 2023 20:31:15 +0100 Subject: [PATCH 5/6] Fix enum names so buffer modification would be properly applied in Managed mode --- sokol_gfx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sokol_gfx.h b/sokol_gfx.h index 891ce9602..572f69008 100644 --- a/sokol_gfx.h +++ b/sokol_gfx.h @@ -12705,7 +12705,7 @@ _SOKOL_PRIVATE void _sg_mtl_update_buffer(_sg_buffer_t* buf, const sg_range* dat void* dst_ptr = [mtl_buf contents]; memcpy(dst_ptr, data->ptr, data->size); #if defined(_SG_TARGET_MACOS) - if (_sg_mtl_resource_options_storage_mode_managed_or_shared() == MTLStorageModeManaged) { + if (_sg_mtl_resource_options_storage_mode_managed_or_shared() == MTLResourceStorageModeManaged) { [mtl_buf didModifyRange:NSMakeRange(0, data->size)]; } #endif @@ -12723,7 +12723,7 @@ _SOKOL_PRIVATE void _sg_mtl_append_buffer(_sg_buffer_t* buf, const sg_range* dat dst_ptr += buf->cmn.append_pos; memcpy(dst_ptr, data->ptr, data->size); #if defined(_SG_TARGET_MACOS) - if (_sg_mtl_resource_options_storage_mode_managed_or_shared() == MTLStorageModeManaged) { + if (_sg_mtl_resource_options_storage_mode_managed_or_shared() == MTLResourceStorageModeManaged) { [mtl_buf didModifyRange:NSMakeRange((NSUInteger)buf->cmn.append_pos, (NSUInteger)data->size)]; } #endif From adf1f83657ac011168412eeb8f98f56dcd2969fe Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Wed, 27 Dec 2023 20:41:00 +0100 Subject: [PATCH 6/6] tests: disable -Wmissing-field-initializers both for GCC and Clang --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c30d5571f..2f11b86e4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -53,7 +53,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") else() set(c_flags ${c_flags} -Wall -Wextra -Werror -Wsign-conversion) set(cxx_flags ${cxx_flags} -Wall -Wextra -Werror -Wsign-conversion -fno-rtti -fno-exceptions) - if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(c_flags ${c_flags} -Wno-missing-field-initializers) set(cxx_flags ${cxx_flags} -Wno-missing-field-initializers) endif()