From c17b13b86b9800463337dff80a16c6539bac5b6b Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Mon, 14 Oct 2024 17:49:59 +0200 Subject: [PATCH] fix more sapp samples for bindings cleanup --- sapp/CMakeLists.txt | 598 +++++++++++++++--------------- sapp/cubemap-jpeg-sapp.c | 10 +- sapp/cubemap-jpeg-sapp.glsl | 6 +- sapp/debugtext-context-sapp.c | 9 +- sapp/debugtext-context-sapp.glsl | 6 +- sapp/drawcallperf-sapp.glsl | 8 +- sapp/dyntex3d-sapp.glsl | 6 +- sapp/fontstash-layers-sapp.c | 4 +- sapp/imgui-usercallback-sapp.c | 6 +- sapp/imgui-usercallback-sapp.glsl | 2 +- sapp/instancing-pull-sapp.c | 8 +- sapp/instancing-pull-sapp.glsl | 4 +- sapp/pixelformats-sapp.c | 18 +- sapp/pixelformats-sapp.glsl | 4 +- sapp/primtypes-sapp.c | 6 +- sapp/primtypes-sapp.glsl | 2 +- sapp/restart-sapp.c | 12 +- sapp/restart-sapp.glsl | 6 +- sapp/shapes-sapp.c | 2 +- sapp/shapes-sapp.glsl | 2 +- sapp/shapes-transform-sapp.c | 2 +- sapp/shapes-transform-sapp.glsl | 2 +- sapp/uniformtypes-sapp.c | 2 +- sapp/uniformtypes-sapp.glsl | 3 +- 24 files changed, 364 insertions(+), 364 deletions(-) diff --git a/sapp/CMakeLists.txt b/sapp/CMakeLists.txt index 03f1cc61..6608e3ba 100644 --- a/sapp/CMakeLists.txt +++ b/sapp/CMakeLists.txt @@ -210,20 +210,20 @@ fips_begin_app(instancing-sapp-ui windowed) target_compile_definitions(instancing-sapp-ui PRIVATE USE_DBG_UI) fips_end_app() -#fips_ide_group(Samples) -#fips_begin_app(instancing-pull-sapp windowed) -# fips_files(instancing-pull-sapp.c) -# sokol_shader(instancing-pull-sapp.glsl ${slang}) -# fips_deps(sokol) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(instancing-pull-sapp-ui windowed) -# fips_files(instancing-pull-sapp.c) -# sokol_shader(instancing-pull-sapp.glsl ${slang}) -# fips_deps(sokol dbgui) -# target_compile_definitions(instancing-pull-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() -# +fips_ide_group(Samples) +fips_begin_app(instancing-pull-sapp windowed) + fips_files(instancing-pull-sapp.c) + sokol_shader(instancing-pull-sapp.glsl ${slang}) + fips_deps(sokol) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(instancing-pull-sapp-ui windowed) + fips_files(instancing-pull-sapp.c) + sokol_shader(instancing-pull-sapp.glsl ${slang}) + fips_deps(sokol dbgui) + target_compile_definitions(instancing-pull-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() + fips_ide_group(Samples) fips_begin_app(mrt-sapp windowed) fips_files(mrt-sapp.c) @@ -280,12 +280,12 @@ fips_begin_app(tex3d-sapp-ui windowed) target_compile_definitions(tex3d-sapp-ui PRIVATE USE_DBG_UI) fips_end_app() -#fips_ide_group(Samples) -#fips_begin_app(dyntex3d-sapp windowed) -# fips_files(dyntex3d-sapp.c) -# sokol_shader(dyntex3d-sapp.glsl ${slang}) -# fips_deps(sokol cimgui) -#fips_end_app() +# fips_ide_group(Samples) +# fips_begin_app(dyntex3d-sapp windowed) +# fips_files(dyntex3d-sapp.c) +# sokol_shader(dyntex3d-sapp.glsl ${slang}) +# fips_deps(sokol cimgui) +# fips_end_app() # fips_ide_group(Samples) fips_begin_app(dyntex-sapp windowed) @@ -315,22 +315,22 @@ fips_begin_app(mipmap-sapp-ui windowed) target_compile_definitions(mipmap-sapp-ui PRIVATE USE_DBG_UI) fips_end_app() -#fips_ide_group(Samples) -#fips_begin_app(cubemap-jpeg-sapp windowed) -# fips_files(cubemap-jpeg-sapp.c) -# sokol_shader(cubemap-jpeg-sapp.glsl ${slang}) -# fips_dir(data) -# fipsutil_copy(cubemap-jpeg-assets.yml) -# fips_deps(sokol fileutil stb) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(cubemap-jpeg-sapp-ui windowed) -# fips_files(cubemap-jpeg-sapp.c) -# sokol_shader(cubemap-jpeg-sapp.glsl ${slang}) -# fips_deps(sokol fileutil stb dbgui) -# target_compile_definitions(cubemap-jpeg-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() -# +fips_ide_group(Samples) +fips_begin_app(cubemap-jpeg-sapp windowed) + fips_files(cubemap-jpeg-sapp.c) + sokol_shader(cubemap-jpeg-sapp.glsl ${slang}) + fips_dir(data) + fipsutil_copy(cubemap-jpeg-assets.yml) + fips_deps(sokol fileutil stb) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(cubemap-jpeg-sapp-ui windowed) + fips_files(cubemap-jpeg-sapp.c) + sokol_shader(cubemap-jpeg-sapp.glsl ${slang}) + fips_deps(sokol fileutil stb dbgui) + target_compile_definitions(cubemap-jpeg-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() + fips_ide_group(Samples) fips_begin_app(basisu-sapp windowed) fips_files(basisu-sapp.c) @@ -375,20 +375,20 @@ fips_begin_app(uvwrap-sapp-ui windowed) target_compile_definitions(uvwrap-sapp-ui PRIVATE USE_DBG_UI) fips_end_app() -#fips_ide_group(Samples) -#fips_begin_app(uniformtypes-sapp windowed) -# fips_files(uniformtypes-sapp.c) -# sokol_shader(uniformtypes-sapp.glsl ${slang}) -# fips_deps(sokol) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(uniformtypes-sapp-ui windowed) -# fips_files(uniformtypes-sapp.c) -# sokol_shader(uniformtypes-sapp.glsl ${slang}) -# fips_deps(sokol dbgui) -# target_compile_definitions(uniformtypes-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() -# +fips_ide_group(Samples) +fips_begin_app(uniformtypes-sapp windowed) + fips_files(uniformtypes-sapp.c) + sokol_shader(uniformtypes-sapp.glsl ${slang}) + fips_deps(sokol) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(uniformtypes-sapp-ui windowed) + fips_files(uniformtypes-sapp.c) + sokol_shader(uniformtypes-sapp.glsl ${slang}) + fips_deps(sokol dbgui) + target_compile_definitions(uniformtypes-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() + fips_ide_group(Samples) fips_begin_app(imgui-sapp windowed) fips_files(imgui-sapp.cc) @@ -427,53 +427,53 @@ fips_begin_app(cimgui-sapp windowed) endif() fips_end_app() -#fips_ide_group(Samples) -#fips_begin_app(imgui-usercallback-sapp windowed) -# fips_files(imgui-usercallback-sapp.c) -# sokol_shader(imgui-usercallback-sapp.glsl ${slang}) -# fips_deps(sokol cimgui) -# if (FIPS_IOS) -# fips_files(ios-info.plist) -# endif() -#fips_end_app() -# -#fips_ide_group(Samples) -#fips_begin_app(imgui-images-sapp windowed) -# fips_files(imgui-images-sapp.c) -# fips_deps(sokol cimgui) -# if (FIPS_IOS) -# fips_files(ios-info.plist) -# endif() -#fips_end_app() -# -#fips_ide_group(Samples) -#fips_begin_app(imgui-perf-sapp windowed) -# fips_files(imgui-perf-sapp.c) -# fips_deps(sokol cimgui) -# if (FIPS_IOS) -# fips_files(ios-info.plist) -# endif() -#fips_end_app() -# -#fips_ide_group(Samples) -#fips_begin_app(events-sapp windowed) -# fips_files(events-sapp.cc) -# fips_deps(sokol imgui) -# if (FIPS_IOS) -# fips_files(ios-info.plist) -# endif() -#fips_end_app() -# -#fips_ide_group(Samples) -#fips_begin_app(pixelformats-sapp windowed) -# fips_files(pixelformats-sapp.c) -# sokol_shader(pixelformats-sapp.glsl ${slang}) -# fips_deps(sokol cimgui) -# if (FIPS_IOS) -# fips_files(ios-info.plist) -# endif() -#fips_end_app() -# +fips_ide_group(Samples) +fips_begin_app(imgui-usercallback-sapp windowed) + fips_files(imgui-usercallback-sapp.c) + sokol_shader(imgui-usercallback-sapp.glsl ${slang}) + fips_deps(sokol cimgui) + if (FIPS_IOS) + fips_files(ios-info.plist) + endif() +fips_end_app() + +fips_ide_group(Samples) +fips_begin_app(imgui-images-sapp windowed) + fips_files(imgui-images-sapp.c) + fips_deps(sokol cimgui) + if (FIPS_IOS) + fips_files(ios-info.plist) + endif() +fips_end_app() + +fips_ide_group(Samples) +fips_begin_app(imgui-perf-sapp windowed) + fips_files(imgui-perf-sapp.c) + fips_deps(sokol cimgui) + if (FIPS_IOS) + fips_files(ios-info.plist) + endif() +fips_end_app() + +fips_ide_group(Samples) +fips_begin_app(events-sapp windowed) + fips_files(events-sapp.cc) + fips_deps(sokol imgui) + if (FIPS_IOS) + fips_files(ios-info.plist) + endif() +fips_end_app() + +fips_ide_group(Samples) +fips_begin_app(pixelformats-sapp windowed) + fips_files(pixelformats-sapp.c) + sokol_shader(pixelformats-sapp.glsl ${slang}) + fips_deps(sokol cimgui) + if (FIPS_IOS) + fips_files(ios-info.plist) + endif() +fips_end_app() + fips_ide_group(Samples) fips_begin_app(sgl-sapp windowed) fips_files(sgl-sapp.c) @@ -615,54 +615,54 @@ fips_begin_app(sdf-sapp-ui windowed) target_compile_definitions(sdf-sapp-ui PRIVATE USE_DBG_UI) fips_end_app() -#fips_ide_group(Samples) -#fips_begin_app(shapes-sapp windowed) -# fips_files(shapes-sapp.c) -# sokol_shader(shapes-sapp.glsl ${slang}) -# fips_deps(sokol) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(shapes-sapp-ui windowed) -# fips_files(shapes-sapp.c) -# sokol_shader(shapes-sapp.glsl ${slang}) -# fips_deps(sokol dbgui) -# target_compile_definitions(shapes-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() -# -#fips_ide_group(Samples) -#fips_begin_app(shapes-transform-sapp windowed) -# fips_files(shapes-transform-sapp.c) -# sokol_shader(shapes-transform-sapp.glsl ${slang}) -# fips_deps(sokol) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(shapes-transform-sapp-ui windowed) -# fips_files(shapes-transform-sapp.c) -# sokol_shader(shapes-transform-sapp.glsl ${slang}) -# fips_deps(sokol dbgui) -# target_compile_definitions(shapes-transform-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() -# -#fips_ide_group(Samples) -#fips_begin_app(primtypes-sapp windowed) -# fips_files(primtypes-sapp.c) -# sokol_shader(primtypes-sapp.glsl ${slang}) -# fips_deps(sokol) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(primtypes-sapp-ui windowed) -# fips_files(primtypes-sapp.c) -# sokol_shader(primtypes-sapp.glsl ${slang}) -# fips_deps(sokol dbgui) -# target_compile_definitions(primtypes-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() -# -#fips_ide_group(Samples) -#fips_begin_app(drawcallperf-sapp windowed) -# fips_files(drawcallperf-sapp.c) -# sokol_shader(drawcallperf-sapp.glsl ${slang}) -# fips_deps(sokol cimgui) -#fips_end_app() +fips_ide_group(Samples) +fips_begin_app(shapes-sapp windowed) + fips_files(shapes-sapp.c) + sokol_shader(shapes-sapp.glsl ${slang}) + fips_deps(sokol) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(shapes-sapp-ui windowed) + fips_files(shapes-sapp.c) + sokol_shader(shapes-sapp.glsl ${slang}) + fips_deps(sokol dbgui) + target_compile_definitions(shapes-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() + +fips_ide_group(Samples) +fips_begin_app(shapes-transform-sapp windowed) + fips_files(shapes-transform-sapp.c) + sokol_shader(shapes-transform-sapp.glsl ${slang}) + fips_deps(sokol) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(shapes-transform-sapp-ui windowed) + fips_files(shapes-transform-sapp.c) + sokol_shader(shapes-transform-sapp.glsl ${slang}) + fips_deps(sokol dbgui) + target_compile_definitions(shapes-transform-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() + +fips_ide_group(Samples) +fips_begin_app(primtypes-sapp windowed) + fips_files(primtypes-sapp.c) + sokol_shader(primtypes-sapp.glsl ${slang}) + fips_deps(sokol) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(primtypes-sapp-ui windowed) + fips_files(primtypes-sapp.c) + sokol_shader(primtypes-sapp.glsl ${slang}) + fips_deps(sokol dbgui) + target_compile_definitions(primtypes-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() + +# fips_ide_group(Samples) +# fips_begin_app(drawcallperf-sapp windowed) +# fips_files(drawcallperf-sapp.c) +# sokol_shader(drawcallperf-sapp.glsl ${slang}) +# fips_deps(sokol cimgui) +# fips_end_app() # fips_ide_group(Samples) fips_begin_app(debugtext-sapp windowed) @@ -700,32 +700,32 @@ fips_begin_app(debugtext-userfont-sapp-ui windowed) target_compile_definitions(debugtext-userfont-sapp-ui PRIVATE USE_DBG_UI) fips_end_app() -#fips_ide_group(Samples) -#fips_begin_app(debugtext-context-sapp windowed) -# fips_files(debugtext-context-sapp.c) -# sokol_shader(debugtext-context-sapp.glsl ${slang}) -# fips_deps(sokol) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(debugtext-context-sapp-ui windowed) -# fips_files(debugtext-context-sapp.c) -# sokol_shader(debugtext-context-sapp.glsl ${slang}) -# fips_deps(sokol dbgui) -# target_compile_definitions(debugtext-context-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() +fips_ide_group(Samples) +fips_begin_app(debugtext-context-sapp windowed) + fips_files(debugtext-context-sapp.c) + sokol_shader(debugtext-context-sapp.glsl ${slang}) + fips_deps(sokol) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(debugtext-context-sapp-ui windowed) + fips_files(debugtext-context-sapp.c) + sokol_shader(debugtext-context-sapp.glsl ${slang}) + fips_deps(sokol dbgui) + target_compile_definitions(debugtext-context-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() + +fips_ide_group(Samples) +fips_begin_app(debugtext-layers-sapp windowed) + fips_files(debugtext-layers-sapp.c) + fips_deps(sokol) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(debugtext-layers-sapp-ui windowed) + fips_files(debugtext-layers-sapp.c) + fips_deps(sokol dbgui) + target_compile_definitions(debugtext-layers-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() -#fips_ide_group(Samples) -#fips_begin_app(debugtext-layers-sapp windowed) -# fips_files(debugtext-layers-sapp.c) -# fips_deps(sokol) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(debugtext-layers-sapp-ui windowed) -# fips_files(debugtext-layers-sapp.c) -# fips_deps(sokol dbgui) -# target_compile_definitions(debugtext-layers-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() -# fips_ide_group(Samples) fips_begin_app(saudio-sapp windowed) fips_files(saudio-sapp.c) @@ -735,21 +735,21 @@ fips_begin_app(saudio-sapp windowed) endif() fips_end_app() -#fips_ide_group(Samples) -#fips_begin_app(icon-sapp windowed) -# fips_files(icon-sapp.c) -# fips_deps(sokol) -#fips_end_app() -# -#fips_ide_group(Samples) -#fips_begin_app(droptest-sapp windowed) -# fips_files(droptest-sapp.c) -# fips_deps(sokol cimgui) -# if (FIPS_IOS) -# fips_files(ios-info.plist) -# endif() -#fips_end_app() -# +fips_ide_group(Samples) +fips_begin_app(icon-sapp windowed) + fips_files(icon-sapp.c) + fips_deps(sokol) +fips_end_app() + +fips_ide_group(Samples) +fips_begin_app(droptest-sapp windowed) + fips_files(droptest-sapp.c) + fips_deps(sokol cimgui) + if (FIPS_IOS) + fips_files(ios-info.plist) + endif() +fips_end_app() + fips_ide_group(Samples) fips_begin_app(fontstash-sapp windowed) fips_files(fontstash-sapp.c) @@ -766,24 +766,24 @@ fips_begin_app(fontstash-sapp-ui windowed) target_compile_definitions(fontstash-sapp-ui PRIVATE USE_DBG_UI) fips_end_app() -#fips_ide_group(Samples) -#fips_begin_app(fontstash-layers-sapp windowed) -# fips_files(fontstash-layers-sapp.c) -# fips_deps(sokol fileutil) -# sokol_shader(fontstash-layers-sapp.glsl ${slang}) -# fips_dir(data) -# fipsutil_copy(fontstash.yml) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(fontstash-layers-sapp-ui windowed) -# fips_files(fontstash-layers-sapp.c) -# fips_deps(sokol fileutil dbgui) -# sokol_shader(fontstash-layers-sapp.glsl ${slang}) -# fips_dir(data) -# fipsutil_copy(fontstash.yml) -# target_compile_definitions(fontstash-layers-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() -# +fips_ide_group(Samples) +fips_begin_app(fontstash-layers-sapp windowed) + fips_files(fontstash-layers-sapp.c) + fips_deps(sokol fileutil) + sokol_shader(fontstash-layers-sapp.glsl ${slang}) + fips_dir(data) + fipsutil_copy(fontstash.yml) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(fontstash-layers-sapp-ui windowed) + fips_files(fontstash-layers-sapp.c) + fips_deps(sokol fileutil dbgui) + sokol_shader(fontstash-layers-sapp.glsl ${slang}) + fips_dir(data) + fipsutil_copy(fontstash.yml) + target_compile_definitions(fontstash-layers-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() + fips_ide_group(Samples) fips_begin_app(modplay-sapp windowed) fips_files(modplay-sapp.c) @@ -795,15 +795,15 @@ fips_begin_app(modplay-sapp windowed) fips_deps(sokol libmodplug) fips_end_app() -#fips_ide_group(Samples) -#fips_begin_app(restart-sapp windowed) -# fips_files(restart-sapp.c) -# sokol_shader(restart-sapp.glsl ${slang}) -# fips_dir(data) -# fipsutil_copy(restart-assets.yml) -# fips_deps(sokol fileutil stb libmodplug) -#fips_end_app() -# +fips_ide_group(Samples) +fips_begin_app(restart-sapp windowed) + fips_files(restart-sapp.c) + sokol_shader(restart-sapp.glsl ${slang}) + fips_dir(data) + fipsutil_copy(restart-assets.yml) + fips_deps(sokol fileutil stb libmodplug) +fips_end_app() + fips_ide_group(Samples) fips_begin_app(plmpeg-sapp windowed) fips_files(plmpeg-sapp.c) @@ -858,94 +858,94 @@ fips_begin_app(loadpng-sapp-ui windowed) target_compile_definitions(loadpng-sapp-ui PRIVATE USE_DBG_UI) fips_end_app() -#fips_ide_group(Samples) -#fips_begin_app(spine-simple-sapp windowed) -# fips_files(spine-simple-sapp.c) -# fips_dir(data) -# fipsutil_copy(spine-assets.yml) -# fips_deps(sokol spine-c stb fileutil) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(spine-simple-sapp-ui windowed) -# fips_files(spine-simple-sapp.c) -# fips_dir(data) -# fipsutil_copy(spine-assets.yml) -# fips_deps(sokol spine-c stb fileutil dbgui) -# target_compile_definitions(spine-simple-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() -# -#fips_ide_group(Samples) -#fips_begin_app(spine-inspector-sapp windowed) -# fips_files(spine-inspector-sapp.c) -# fips_dir(data) -# fipsutil_copy(spine-assets.yml) -# fips_deps(sokol spine-c stb fileutil cimgui) -#fips_end_app() -# -#fips_ide_group(Samples) -#fips_begin_app(spine-skinsets-sapp windowed) -# fips_files(spine-skinsets-sapp.c) -# fips_dir(data) -# fipsutil_copy(spine-assets.yml) -# fips_deps(sokol spine-c stb fileutil) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(spine-skinsets-sapp-ui windowed) -# fips_files(spine-skinsets-sapp.c) -# fips_dir(data) -# fipsutil_copy(spine-assets.yml) -# fips_deps(sokol spine-c stb fileutil dbgui) -# target_compile_definitions(spine-skinsets-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() -# -#fips_ide_group(Samples) -#fips_begin_app(spine-layers-sapp windowed) -# fips_files(spine-layers-sapp.c) -# fips_dir(data) -# fipsutil_copy(spine-assets.yml) -# fips_deps(sokol spine-c stb fileutil) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(spine-layers-sapp-ui windowed) -# fips_files(spine-layers-sapp.c) -# fips_dir(data) -# fipsutil_copy(spine-assets.yml) -# fips_deps(sokol spine-c stb fileutil dbgui) -# target_compile_definitions(spine-layers-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() -# -#fips_ide_group(Samples) -#fips_begin_app(spine-contexts-sapp windowed) -# fips_files(spine-contexts-sapp.c) -# fips_dir(data) -# fipsutil_copy(spine-assets.yml) -# fips_deps(sokol spine-c stb fileutil) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(spine-contexts-sapp-ui windowed) -# fips_files(spine-contexts-sapp.c) -# fips_dir(data) -# fipsutil_copy(spine-assets.yml) -# fips_deps(sokol spine-c stb fileutil dbgui) -# target_compile_definitions(spine-contexts-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() -# -#fips_ide_group(Samples) -#fips_begin_app(spine-switch-skinsets-sapp windowed) -# fips_files(spine-switch-skinsets-sapp.c) -# fips_dir(data) -# fipsutil_copy(spine-assets.yml) -# fips_deps(sokol spine-c stb fileutil) -#fips_end_app() -#fips_ide_group(SamplesWithDebugUI) -#fips_begin_app(spine-switch-skinsets-sapp-ui windowed) -# fips_files(spine-switch-skinsets-sapp.c) -# fips_dir(data) -# fipsutil_copy(spine-assets.yml) -# fips_deps(sokol spine-c stb fileutil dbgui) -# target_compile_definitions(spine-switch-skinsets-sapp-ui PRIVATE USE_DBG_UI) -#fips_end_app() +fips_ide_group(Samples) +fips_begin_app(spine-simple-sapp windowed) + fips_files(spine-simple-sapp.c) + fips_dir(data) + fipsutil_copy(spine-assets.yml) + fips_deps(sokol spine-c stb fileutil) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(spine-simple-sapp-ui windowed) + fips_files(spine-simple-sapp.c) + fips_dir(data) + fipsutil_copy(spine-assets.yml) + fips_deps(sokol spine-c stb fileutil dbgui) + target_compile_definitions(spine-simple-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() + +# fips_ide_group(Samples) +# fips_begin_app(spine-inspector-sapp windowed) +# fips_files(spine-inspector-sapp.c) +# fips_dir(data) +# fipsutil_copy(spine-assets.yml) +# fips_deps(sokol spine-c stb fileutil cimgui) +# fips_end_app() # +fips_ide_group(Samples) +fips_begin_app(spine-skinsets-sapp windowed) + fips_files(spine-skinsets-sapp.c) + fips_dir(data) + fipsutil_copy(spine-assets.yml) + fips_deps(sokol spine-c stb fileutil) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(spine-skinsets-sapp-ui windowed) + fips_files(spine-skinsets-sapp.c) + fips_dir(data) + fipsutil_copy(spine-assets.yml) + fips_deps(sokol spine-c stb fileutil dbgui) + target_compile_definitions(spine-skinsets-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() + +fips_ide_group(Samples) +fips_begin_app(spine-layers-sapp windowed) + fips_files(spine-layers-sapp.c) + fips_dir(data) + fipsutil_copy(spine-assets.yml) + fips_deps(sokol spine-c stb fileutil) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(spine-layers-sapp-ui windowed) + fips_files(spine-layers-sapp.c) + fips_dir(data) + fipsutil_copy(spine-assets.yml) + fips_deps(sokol spine-c stb fileutil dbgui) + target_compile_definitions(spine-layers-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() + +fips_ide_group(Samples) +fips_begin_app(spine-contexts-sapp windowed) + fips_files(spine-contexts-sapp.c) + fips_dir(data) + fipsutil_copy(spine-assets.yml) + fips_deps(sokol spine-c stb fileutil) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(spine-contexts-sapp-ui windowed) + fips_files(spine-contexts-sapp.c) + fips_dir(data) + fipsutil_copy(spine-assets.yml) + fips_deps(sokol spine-c stb fileutil dbgui) + target_compile_definitions(spine-contexts-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() + +fips_ide_group(Samples) +fips_begin_app(spine-switch-skinsets-sapp windowed) + fips_files(spine-switch-skinsets-sapp.c) + fips_dir(data) + fipsutil_copy(spine-assets.yml) + fips_deps(sokol spine-c stb fileutil) +fips_end_app() +fips_ide_group(SamplesWithDebugUI) +fips_begin_app(spine-switch-skinsets-sapp-ui windowed) + fips_files(spine-switch-skinsets-sapp.c) + fips_dir(data) + fipsutil_copy(spine-assets.yml) + fips_deps(sokol spine-c stb fileutil dbgui) + target_compile_definitions(spine-switch-skinsets-sapp-ui PRIVATE USE_DBG_UI) +fips_end_app() + #fips_ide_group(Samples) #fips_begin_app(ozz-anim-sapp windowed) # fips_files(ozz-anim-sapp.cc) diff --git a/sapp/cubemap-jpeg-sapp.c b/sapp/cubemap-jpeg-sapp.c index 78609fea..daa6add6 100644 --- a/sapp/cubemap-jpeg-sapp.c +++ b/sapp/cubemap-jpeg-sapp.c @@ -138,10 +138,10 @@ static void init(void) { }); // allocate a texture handle, but initialize the texture later after data is loaded - state.bind.fs.images[SLOT_tex] = sg_alloc_image(); + state.bind.images[IMG_tex] = sg_alloc_image(); // a sampler object - state.bind.fs.samplers[SLOT_smp] = sg_make_sampler(&(sg_sampler_desc){ + state.bind.samplers[SMP_smp] = sg_make_sampler(&(sg_sampler_desc){ .min_filter = SG_FILTER_LINEAR, .mag_filter = SG_FILTER_LINEAR, .label = "cubemap-sampler" @@ -149,7 +149,7 @@ static void init(void) { // a pipeline object state.pip = sg_make_pipeline(&(sg_pipeline_desc){ - .layout.attrs[ATTR_vs_pos].format = SG_VERTEXFORMAT_FLOAT3, + .layout.attrs[ATTR_cubemap_pos].format = SG_VERTEXFORMAT_FLOAT3, .shader = sg_make_shader(cubemap_shader_desc(sg_query_backend())), .index_type = SG_INDEXTYPE_UINT16, .depth = { @@ -193,7 +193,7 @@ static void fetch_cb(const sfetch_response_t* response) { stbi_image_free(decoded_pixels); // all 6 faces loaded? if (++state.load_count == SG_CUBEFACE_NUM) { - sg_init_image(state.bind.fs.images[SLOT_tex], &(sg_image_desc){ + sg_init_image(state.bind.images[IMG_tex], &(sg_image_desc){ .type = SG_IMAGETYPE_CUBE, .width = width, .height = height, @@ -237,7 +237,7 @@ static void frame(void) { sg_begin_pass(&(sg_pass){ .action = state.pass_action, .swapchain = sglue_swapchain() }); sg_apply_pipeline(state.pip); sg_apply_bindings(&state.bind), - sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_vs_params, &SG_RANGE(vs_params)); + sg_apply_uniforms(UB_vs_params, &SG_RANGE(vs_params)); sg_draw(0, 36, 1); sdtx_draw(); __dbgui_draw(); diff --git a/sapp/cubemap-jpeg-sapp.glsl b/sapp/cubemap-jpeg-sapp.glsl index b71ebbf3..e71d6948 100644 --- a/sapp/cubemap-jpeg-sapp.glsl +++ b/sapp/cubemap-jpeg-sapp.glsl @@ -1,7 +1,7 @@ @ctype mat4 hmm_mat4 @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { mat4 mvp; }; @@ -15,8 +15,8 @@ void main() { @end @fs fs -uniform textureCube tex; -uniform sampler smp; +layout(binding=0) uniform textureCube tex; +layout(binding=0) uniform sampler smp; in vec3 uvw; out vec4 frag_color; diff --git a/sapp/debugtext-context-sapp.c b/sapp/debugtext-context-sapp.c index 60e84d63..b6f9a1ae 100644 --- a/sapp/debugtext-context-sapp.c +++ b/sapp/debugtext-context-sapp.c @@ -136,8 +136,8 @@ static void init(void) { state.pip = sg_make_pipeline(&(sg_pipeline_desc){ .layout = { .attrs = { - [ATTR_vs_pos].format = SG_VERTEXFORMAT_FLOAT3, - [ATTR_vs_texcoord0].format = SG_VERTEXFORMAT_SHORT2N + [ATTR_debugtext_context_pos].format = SG_VERTEXFORMAT_FLOAT3, + [ATTR_debugtext_context_texcoord0].format = SG_VERTEXFORMAT_SHORT2N } }, .shader = sg_make_shader(debugtext_context_shader_desc(sg_query_backend())), @@ -247,12 +247,13 @@ static void frame(void) { // draw the cube as 6 separate draw calls (because each has its own texture) sg_apply_pipeline(state.pip); - sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_vs_params, &SG_RANGE(vs_params)); + sg_apply_uniforms(UB_vs_params, &SG_RANGE(vs_params)); for (int i = 0; i < NUM_FACES; i++) { sg_apply_bindings(&(sg_bindings){ .vertex_buffers[0] = state.vbuf, .index_buffer = state.ibuf, - .fs = { .images[0] = state.passes[i].img, .samplers[0] = state.smp } + .images[IMG_tex] = state.passes[i].img, + .samplers[SMP_smp] = state.smp }); sg_draw(i * 6, 6, 1); } diff --git a/sapp/debugtext-context-sapp.glsl b/sapp/debugtext-context-sapp.glsl index 30ed231e..d20ca3d3 100644 --- a/sapp/debugtext-context-sapp.glsl +++ b/sapp/debugtext-context-sapp.glsl @@ -4,7 +4,7 @@ @ctype mat4 hmm_mat4 @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { mat4 mvp; }; @@ -24,8 +24,8 @@ void main() { @end @fs fs -uniform texture2D tex; -uniform sampler smp; +layout(binding=0) uniform texture2D tex; +layout(binding=0) uniform sampler smp; in vec2 uv; out vec4 frag_color; diff --git a/sapp/drawcallperf-sapp.glsl b/sapp/drawcallperf-sapp.glsl index 0fc7efa3..5285f89c 100644 --- a/sapp/drawcallperf-sapp.glsl +++ b/sapp/drawcallperf-sapp.glsl @@ -2,11 +2,11 @@ @ctype vec4 hmm_vec4 @vs vs -uniform vs_per_frame { +layout(binding=0) uniform vs_per_frame { mat4 viewproj; }; -uniform vs_per_instance { +layout(binding=1) uniform vs_per_instance { vec4 world_pos; }; @@ -24,8 +24,8 @@ void main() { @end @fs fs -uniform texture2D tex; -uniform sampler smp; +layout(binding=0) uniform texture2D tex; +layout(binding=0) uniform sampler smp; in vec2 uv; in float bright; diff --git a/sapp/dyntex3d-sapp.glsl b/sapp/dyntex3d-sapp.glsl index a8695d4b..ee583e39 100644 --- a/sapp/dyntex3d-sapp.glsl +++ b/sapp/dyntex3d-sapp.glsl @@ -4,7 +4,7 @@ @ctype mat4 hmm_mat4 @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { float w; }; @@ -21,8 +21,8 @@ void main() { @end @fs fs -uniform texture3D tex; -uniform sampler smp; +layout(binding=0) uniform texture3D tex; +layout(binding=0) uniform sampler smp; in vec3 uvw; out vec4 frag_color; diff --git a/sapp/fontstash-layers-sapp.c b/sapp/fontstash-layers-sapp.c index 4de7defd..bdea59e4 100644 --- a/sapp/fontstash-layers-sapp.c +++ b/sapp/fontstash-layers-sapp.c @@ -104,8 +104,8 @@ static void init(void) { .shader = sg_make_shader(triangle_shader_desc(sg_query_backend())), .layout = { .attrs = { - [ATTR_vs_position].format = SG_VERTEXFORMAT_FLOAT3, - [ATTR_vs_color0].format = SG_VERTEXFORMAT_FLOAT4, + [ATTR_triangle_position].format = SG_VERTEXFORMAT_FLOAT3, + [ATTR_triangle_color0].format = SG_VERTEXFORMAT_FLOAT4, } }, .colors[0] = { diff --git a/sapp/imgui-usercallback-sapp.c b/sapp/imgui-usercallback-sapp.c index fcfd5790..1467d9db 100644 --- a/sapp/imgui-usercallback-sapp.c +++ b/sapp/imgui-usercallback-sapp.c @@ -116,8 +116,8 @@ void init(void) { state.scene1.pip = sg_make_pipeline(&(sg_pipeline_desc){ .layout = { .attrs = { - [ATTR_vs_position].format = SG_VERTEXFORMAT_FLOAT3, - [ATTR_vs_color0].format = SG_VERTEXFORMAT_FLOAT4 + [ATTR_scene_position].format = SG_VERTEXFORMAT_FLOAT3, + [ATTR_scene_color0].format = SG_VERTEXFORMAT_FLOAT4 } }, .shader = sg_make_shader(scene_shader_desc(sg_query_backend())), @@ -180,7 +180,7 @@ void draw_scene_1(const ImDrawList* dl, const ImDrawCmd* cmd) { */ sg_apply_pipeline(state.scene1.pip); sg_apply_bindings(&state.scene1.bind); - sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_vs_params, &SG_RANGE(vs_params)); + sg_apply_uniforms(UB_vs_params, &SG_RANGE(vs_params)); sg_draw(0, 36, 1); } diff --git a/sapp/imgui-usercallback-sapp.glsl b/sapp/imgui-usercallback-sapp.glsl index 3d9ccb3b..5f9ab0ec 100644 --- a/sapp/imgui-usercallback-sapp.glsl +++ b/sapp/imgui-usercallback-sapp.glsl @@ -1,7 +1,7 @@ @ctype mat4 hmm_mat4 @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { mat4 mvp; }; diff --git a/sapp/instancing-pull-sapp.c b/sapp/instancing-pull-sapp.c index 5ae5f3fb..21b27857 100644 --- a/sapp/instancing-pull-sapp.c +++ b/sapp/instancing-pull-sapp.c @@ -64,7 +64,7 @@ static void init(void) { { .pos = HMM_Vec3( -r, 0.0f, r ), .color = HMM_Vec4(0.0f, 1.0f, 1.0f, 1.0f) }, { .pos = HMM_Vec3(0.0f, r, 0.0f), .color = HMM_Vec4(1.0f, 0.0f, 1.0f, 1.0f) }, }; - state.bind.vs.storage_buffers[SLOT_vertices] = sg_make_buffer(&(sg_buffer_desc){ + state.bind.storage_buffers[SBUF_vertices] = sg_make_buffer(&(sg_buffer_desc){ .type = SG_BUFFERTYPE_STORAGEBUFFER, .data = SG_RANGE(vertices), .label = "geometry-vertices", @@ -82,7 +82,7 @@ static void init(void) { }); // a dynamic storage buffer for the per-instance data - state.bind.vs.storage_buffers[SLOT_instances] = sg_make_buffer(&(sg_buffer_desc) { + state.bind.storage_buffers[SBUF_instances] = sg_make_buffer(&(sg_buffer_desc) { .type = SG_BUFFERTYPE_STORAGEBUFFER, .usage = SG_USAGE_STREAM, .size = MAX_PARTICLES * sizeof(sb_instance_t), @@ -115,7 +115,7 @@ static void frame(void) { update_particles(frame_time); // update instance data storage buffer - sg_update_buffer(state.bind.vs.storage_buffers[SLOT_instances], &(sg_range){ + sg_update_buffer(state.bind.storage_buffers[SBUF_instances], &(sg_range){ .ptr = state.inst, .size = (size_t)state.cur_num_particles * sizeof(sb_instance_t), }); @@ -127,7 +127,7 @@ static void frame(void) { sg_begin_pass(&(sg_pass){ .action = state.pass_action, .swapchain = sglue_swapchain() }); sg_apply_pipeline(state.pip); sg_apply_bindings(&state.bind); - sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_vs_params, &SG_RANGE(vs_params)); + sg_apply_uniforms(UB_vs_params, &SG_RANGE(vs_params)); sg_draw(0, 24, state.cur_num_particles); __dbgui_draw(); sg_end_pass(); diff --git a/sapp/instancing-pull-sapp.glsl b/sapp/instancing-pull-sapp.glsl index 41688b63..b6954a82 100644 --- a/sapp/instancing-pull-sapp.glsl +++ b/sapp/instancing-pull-sapp.glsl @@ -16,11 +16,11 @@ struct sb_instance { vec3 pos; }; -readonly buffer vertices { +layout(binding=0) readonly buffer vertices { sb_vertex vtx[]; }; -readonly buffer instances { +layout(binding=1) readonly buffer instances { sb_instance inst[]; }; diff --git a/sapp/pixelformats-sapp.c b/sapp/pixelformats-sapp.c index 98d5f7b4..b50249e8 100644 --- a/sapp/pixelformats-sapp.c +++ b/sapp/pixelformats-sapp.c @@ -98,8 +98,8 @@ static void init(void) { sg_pipeline_desc cube_render_pip_desc = { .layout = { .attrs = { - [ATTR_vs_cube_pos].format = SG_VERTEXFORMAT_FLOAT3, - [ATTR_vs_cube_color0].format = SG_VERTEXFORMAT_FLOAT4 + [ATTR_cube_pos].format = SG_VERTEXFORMAT_FLOAT3, + [ATTR_cube_color0].format = SG_VERTEXFORMAT_FLOAT4 } }, .shader = sg_make_shader(cube_shader_desc(sg_query_backend())), @@ -113,7 +113,7 @@ static void init(void) { }, }; sg_pipeline_desc bg_render_pip_desc = { - .layout.attrs[ATTR_vs_bg_position].format = SG_VERTEXFORMAT_FLOAT2, + .layout.attrs[ATTR_bg_position].format = SG_VERTEXFORMAT_FLOAT2, .shader = sg_make_shader(bg_shader_desc(sg_query_backend())), .primitive_type = SG_PRIMITIVETYPE_TRIANGLE_STRIP, .sample_count = 1, @@ -317,11 +317,11 @@ static void frame(void) { sg_begin_pass(&(sg_pass){ .attachments = state.fmt[i].render_atts }); sg_apply_pipeline(state.fmt[i].bg_render_pip); sg_apply_bindings(&state.bg_bindings); - sg_apply_uniforms(SG_SHADERSTAGE_FS, SLOT_bg_fs_params, &SG_RANGE(state.bg_fs_params)); + sg_apply_uniforms(UB_bg_fs_params, &SG_RANGE(state.bg_fs_params)); sg_draw(0, 4, 1); sg_apply_pipeline(state.fmt[i].cube_render_pip); sg_apply_bindings(&state.cube_bindings); - sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_cube_vs_params, &SG_RANGE(state.cube_vs_params)); + sg_apply_uniforms(UB_cube_vs_params, &SG_RANGE(state.cube_vs_params)); sg_draw(0, 36, 1); sg_end_pass(); } @@ -329,11 +329,11 @@ static void frame(void) { sg_begin_pass(&(sg_pass){ .attachments = state.fmt[i].blend_atts }); sg_apply_pipeline(state.fmt[i].bg_render_pip); // not a bug sg_apply_bindings(&state.bg_bindings); // not a bug - sg_apply_uniforms(SG_SHADERSTAGE_FS, SLOT_bg_fs_params, &SG_RANGE(state.bg_fs_params)); + sg_apply_uniforms(UB_bg_fs_params, &SG_RANGE(state.bg_fs_params)); sg_draw(0, 4, 1); sg_apply_pipeline(state.fmt[i].cube_blend_pip); sg_apply_bindings(&state.cube_bindings); - sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_cube_vs_params, &SG_RANGE(state.cube_vs_params)); + sg_apply_uniforms(UB_cube_vs_params, &SG_RANGE(state.cube_vs_params)); sg_draw(0, 36, 1); sg_end_pass(); } @@ -341,11 +341,11 @@ static void frame(void) { sg_begin_pass(&(sg_pass){ .attachments = state.fmt[i].msaa_atts, .action = { .colors[0].store_action = SG_STOREACTION_DONTCARE } }); sg_apply_pipeline(state.fmt[i].bg_msaa_pip); sg_apply_bindings(&state.bg_bindings); - sg_apply_uniforms(SG_SHADERSTAGE_FS, SLOT_bg_fs_params, &SG_RANGE(state.bg_fs_params)); + sg_apply_uniforms(UB_bg_fs_params, &SG_RANGE(state.bg_fs_params)); sg_draw(0, 4, 1); sg_apply_pipeline(state.fmt[i].cube_msaa_pip); sg_apply_bindings(&state.cube_bindings); - sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_cube_vs_params, &SG_RANGE(state.cube_vs_params)); + sg_apply_uniforms(UB_cube_vs_params, &SG_RANGE(state.cube_vs_params)); sg_draw(0, 36, 1); sg_end_pass(); } diff --git a/sapp/pixelformats-sapp.glsl b/sapp/pixelformats-sapp.glsl index 0ef8f753..94d1e84d 100644 --- a/sapp/pixelformats-sapp.glsl +++ b/sapp/pixelformats-sapp.glsl @@ -1,7 +1,7 @@ @ctype mat4 hmm_mat4 @vs vs_cube -uniform cube_vs_params { +layout(binding=0) uniform cube_vs_params { mat4 mvp; }; in vec4 pos; @@ -34,7 +34,7 @@ void main() { @end @fs fs_bg -uniform bg_fs_params { +layout(binding=0) uniform bg_fs_params { float tick; }; diff --git a/sapp/primtypes-sapp.c b/sapp/primtypes-sapp.c index 5fe1ccf5..e3b29aac 100644 --- a/sapp/primtypes-sapp.c +++ b/sapp/primtypes-sapp.c @@ -105,8 +105,8 @@ static void init(void) { // create pipeline state objects for each primitive type sg_pipeline_desc pip_desc = { .layout = { - .attrs[ATTR_vs_position].format = SG_VERTEXFORMAT_FLOAT2, - .attrs[ATTR_vs_color0].format = SG_VERTEXFORMAT_UBYTE4N, + .attrs[ATTR_primtypes_position].format = SG_VERTEXFORMAT_FLOAT2, + .attrs[ATTR_primtypes_color0].format = SG_VERTEXFORMAT_UBYTE4N, }, .shader = sg_make_shader(primtypes_shader_desc(sg_query_backend())), .depth = { @@ -157,7 +157,7 @@ static void frame(void) { .vertex_buffers[0] = state.vbuf, .index_buffer = state.prim[state.cur_prim_type].ibuf, }); - sg_apply_uniforms(SG_SHADERSTAGE_VS, 0, &SG_RANGE(vs_params)); + sg_apply_uniforms(UB_vs_params, &SG_RANGE(vs_params)); sg_draw(0, state.prim[state.cur_prim_type].num_elements, 1); sdtx_draw(); __dbgui_draw(); diff --git a/sapp/primtypes-sapp.glsl b/sapp/primtypes-sapp.glsl index 842d9100..1d3cb335 100644 --- a/sapp/primtypes-sapp.glsl +++ b/sapp/primtypes-sapp.glsl @@ -1,7 +1,7 @@ @ctype mat4 hmm_mat4 @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { mat4 mvp; float point_size; }; diff --git a/sapp/restart-sapp.c b/sapp/restart-sapp.c index 521630d5..367f8ccb 100644 --- a/sapp/restart-sapp.c +++ b/sapp/restart-sapp.c @@ -182,7 +182,7 @@ static void init(void) { }); // setup rendering resources - state.scene.bind.fs.images[0] = sg_alloc_image(); + state.scene.bind.images[IMG_tex] = sg_alloc_image(); state.scene.bind.vertex_buffers[0] = sg_make_buffer(&(sg_buffer_desc){ .data = SG_RANGE(cube_vertices), @@ -195,7 +195,7 @@ static void init(void) { .label = "cube-indices" }); - state.scene.bind.fs.samplers[SLOT_smp] = sg_make_sampler(&(sg_sampler_desc){ + state.scene.bind.samplers[SMP_smp] = sg_make_sampler(&(sg_sampler_desc){ .min_filter = SG_FILTER_LINEAR, .mag_filter = SG_FILTER_LINEAR, }); @@ -204,8 +204,8 @@ static void init(void) { .shader = sg_make_shader(restart_shader_desc(sg_query_backend())), .layout = { .attrs = { - [ATTR_vs_pos].format = SG_VERTEXFORMAT_FLOAT3, - [ATTR_vs_texcoord0].format = SG_VERTEXFORMAT_SHORT2N + [ATTR_restart_pos].format = SG_VERTEXFORMAT_FLOAT3, + [ATTR_restart_texcoord0].format = SG_VERTEXFORMAT_SHORT2N } }, .index_type = SG_INDEXTYPE_UINT16, @@ -262,7 +262,7 @@ static void fetch_img_callback(const sfetch_response_t* response) { &png_width, &png_height, &num_channels, desired_channels); if (pixels) { - sg_init_image(state.scene.bind.fs.images[SLOT_tex], &(sg_image_desc){ + sg_init_image(state.scene.bind.images[IMG_tex], &(sg_image_desc){ .width = png_width, .height = png_height, .pixel_format = SG_PIXELFORMAT_RGBA8, @@ -393,7 +393,7 @@ static void frame(void) { sg_begin_pass(&(sg_pass){ .action = state.scene.pass_action, .swapchain = sglue_swapchain() }); sg_apply_pipeline(state.scene.pip); sg_apply_bindings(&state.scene.bind); - sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_vs_params, &SG_RANGE(vs_params)); + sg_apply_uniforms(UB_vs_params, &SG_RANGE(vs_params)); sg_draw(0, 36, 1); sgl_draw(); sdtx_draw(); diff --git a/sapp/restart-sapp.glsl b/sapp/restart-sapp.glsl index 06e26d07..3905f026 100644 --- a/sapp/restart-sapp.glsl +++ b/sapp/restart-sapp.glsl @@ -5,7 +5,7 @@ @ctype mat4 hmm_mat4 @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { mat4 mvp; }; @@ -20,8 +20,8 @@ void main() { @end @fs fs -uniform texture2D tex; -uniform sampler smp; +layout(binding=0) uniform texture2D tex; +layout(binding=0) uniform sampler smp; in vec2 uv; out vec4 frag_color; diff --git a/sapp/shapes-sapp.c b/sapp/shapes-sapp.c index d6b6e8df..776aafcd 100644 --- a/sapp/shapes-sapp.c +++ b/sapp/shapes-sapp.c @@ -170,7 +170,7 @@ static void frame(void) { // per shape model-view-projection matrix hmm_mat4 model = HMM_MultiplyMat4(HMM_Translate(state.shapes[i].pos), rm); state.vs_params.mvp = HMM_MultiplyMat4(view_proj, model); - sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_vs_params, &SG_RANGE(state.vs_params)); + sg_apply_uniforms(UB_vs_params, &SG_RANGE(state.vs_params)); sg_draw(state.shapes[i].draw.base_element, state.shapes[i].draw.num_elements, 1); } sdtx_draw(); diff --git a/sapp/shapes-sapp.glsl b/sapp/shapes-sapp.glsl index 06799db0..a3033e59 100644 --- a/sapp/shapes-sapp.glsl +++ b/sapp/shapes-sapp.glsl @@ -1,7 +1,7 @@ @ctype mat4 hmm_mat4 @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { mat4 mvp; float draw_mode; }; diff --git a/sapp/shapes-transform-sapp.c b/sapp/shapes-transform-sapp.c index 15388648..f97699a0 100644 --- a/sapp/shapes-transform-sapp.c +++ b/sapp/shapes-transform-sapp.c @@ -149,7 +149,7 @@ static void frame(void) { sg_begin_pass(&(sg_pass){ .action = state.pass_action, .swapchain = sglue_swapchain() }); sg_apply_pipeline(state.pip); sg_apply_bindings(&state.bind); - sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_vs_params, &SG_RANGE(state.vs_params)); + sg_apply_uniforms(UB_vs_params, &SG_RANGE(state.vs_params)); sg_draw(state.elms.base_element, state.elms.num_elements, 1); // render help text and finish frame diff --git a/sapp/shapes-transform-sapp.glsl b/sapp/shapes-transform-sapp.glsl index 2247ecc0..2bea6a56 100644 --- a/sapp/shapes-transform-sapp.glsl +++ b/sapp/shapes-transform-sapp.glsl @@ -1,7 +1,7 @@ @ctype mat4 hmm_mat4 @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { float draw_mode; mat4 mvp; }; diff --git a/sapp/uniformtypes-sapp.c b/sapp/uniformtypes-sapp.c index 04f961ba..371ce911 100644 --- a/sapp/uniformtypes-sapp.c +++ b/sapp/uniformtypes-sapp.c @@ -118,7 +118,7 @@ static void frame(void) { state.vs_params.sel = i; state.vs_params.offset[0] = x0; state.vs_params.offset[1] = y0; - sg_apply_uniforms(SG_SHADERSTAGE_VS, 0, &SG_RANGE(state.vs_params)); + sg_apply_uniforms(UB_vs_params, &SG_RANGE(state.vs_params)); sg_draw(0, 6, 1); y0 -= 4.0f * glyph_h; } diff --git a/sapp/uniformtypes-sapp.glsl b/sapp/uniformtypes-sapp.glsl index a5786924..efca41cc 100644 --- a/sapp/uniformtypes-sapp.glsl +++ b/sapp/uniformtypes-sapp.glsl @@ -4,7 +4,7 @@ // inefficient in the sokol-gfx GL backend, because the uniform // block will not be flattened into a single float or int array! // -uniform vs_params { +layout(binding=0) uniform vs_params { vec2 offset; vec2 scale; // scramble the vector sizes to enforce 'weird' padding @@ -67,4 +67,3 @@ void main() { @end @program uniformtypes vs fs -