Skip to content

Commit

Permalink
sokol: update to match 9e0f1b4
Browse files Browse the repository at this point in the history
  • Loading branch information
larpon committed Oct 28, 2023
1 parent 3d9500f commit a6ccb54
Show file tree
Hide file tree
Showing 7 changed files with 3,532 additions and 2,193 deletions.
138 changes: 138 additions & 0 deletions thirdparty/sokol/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,143 @@
## Updates

#### 27-Oct-2023

Fix broken render-to-mipmap in the sokol_gfx.h GL backend.

There was a subtle bug / "feature gap" lurking in sokol_gfx.h GL backend: trying
to render to any mipmap except the top-level mipmap resulted in a black screen
because of an incomplete-framebuffer error. This is fixed now. The changes in detail:

- creating a texture in the GL backend now sets the GL_TEXTURE_MAX_LEVEL property
(this is the fix to make everything work)
- the framebuffer completeness check in the GL backend now has more detailed error logging
- in the validation layer, the requirement that a sampler that's used with a
single-mipmap-texture must use `.mipmap_filter = SG_FILTER_NONE` has been
relaxed (a later update will remove SG_FILTER_NONE entirely since it's not needed anymore
and the concept of a "none" mipmap filter only exists in GL and Metal, but not D3D, WebGPU
and Vulkan)

Ticket: https://github.com/floooh/sokol/issues/923

PR: https://github.com/floooh/sokol/pull/924

There's also a new render-to-mipmap sample which covers to close this 'feature gap':

https://floooh.github.io/sokol-html5/miprender-sapp.html

A couple of similar samples will follow over the next few days
(rendering to texture array layers and 3d texture slices).

#### 26-Oct-2023

- sokol_app.h gl: fix a regression introduced in https://github.com/floooh/sokol/pull/916
which could select the wrong framebuffer pixel format and break rendering
on some GL drivers (in my case: an older Intel GPU).

If you are using the GL backend on Windows, please make sure to upgrade!

#### 23-Oct-2023

- sokol_app.h gl: some further startup optimizations in the WGL code path
via PR https://github.com/floooh/sokol/pull/916

#### 21-Oct-2023

The major topic of this update is the 'finalized' WebGPU support in sokol_gfx.h and sokol_app.h.

- WebGPU samples are hosted here:

https://floooh.github.io/sokol-webgpu/

- WebGL2 samples remain hosted here:

https://floooh.github.io/sokol-html5/

- Please read the following blog post as introduction:

https://floooh.github.io/2023/10/16/sokol-webgpu.html

- ...and the changelog and updated documentation in the sokol-shdc repository:

https://github.com/floooh/sokol-tools

- You'll also need to update the sokol-shdc binaries:

https://github.com/floooh/sokol-tools-bin

- Please also read the following new or updated sections in the embedded sokol_gfx.h header documentation:

- `ON SHADER CREATION`
- `ON SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT AND SG_SAMPLERTYPE_NONFILTERING`
- `WEBGPU CAVEATS`

Please do this especially when using any of the following texture pixel formats, as you will most likely encounter new validation layer errors:

- `SG_PIXELFORMAT_R32F`
- `SG_PIXELFORMAT_RG32F`
- `SG_PIXELFORMAT_RGBA32F`

- There is a tiny breaking change in the sokol_gfx.h API (only requires action when not using sokol-shdc):

- the following `sg_sampler_type` enum items have been renamed to better match their WebGPU counterparts:
- SG_SAMPLERTYPE_SAMPLE => SG_SAMPLERTYPE_FILTERING
- SG_SAMPLERTYPE_COMPARE => SG_SAMPLERTYPE_COMPARISON

- the enum `sg_image_sample_type` gained a new item:
- SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT

- the enum `sg_sampler_type` gained a new item:
- SG_SAMPLERTYPE_NONFILTERING

- The sokol_gfx.h struct `sg_desc` has two new items:
- `.wgpu_bindgroups_cache_size` - must be power-of-2, default: 1024
- `.wgpu_disable_bindgroups_cache` - default: false

- sokol_gfx.h gained the following new public API functions to query per-frame information:
- `sg_frame_stats sg_query_frame_stats()`
- `void sg_enable_frame_stats(void)`
- `void sg_disable_frame_stats(void)`
- `bool sg_frame_stats_enabled(void)`

Frame statistics gathering is enabled after startup, but can be temporarily
disabled and enabled again via `sg_disable_frame_stats()` and `sg_enable_frame_stats`.

- The sokol_gfx.h validation layer has new validation checks in `sg_make_shader()`
regarding image/sampler pair compatibility (WebGPU is particularly strict about
this stuff).

- In sokol_app.h, the old wip WebGPU device and swapchain setup code is now implemented
in pure C code (previously this was a mix of Javascript and C).

- Also note that sokol_app.h currently only supports WebGPU in the Emscripten backend.
If you want to use sokol_gfx.h with the WebGPU backend in a native scenario, you'll have
to use a different window system glue library (like GLFW). The sokol-samples directory
has a handful of examples for using sokol_gfx.h + Dawn + GLFW.

- The following headers have been made compatible with the sokol_gfx.h WebGPU backend
(mainly by embedding WGSL shader code):
- sokol_debugtext.h
- sokol_fontstash.h
- sokol_gl.h
- sokol_spine.h
- sokol_imgui.h (also required some more changes for embedding `unfilterable-float`
textures, since these now require separate shader and pipeline objects)
- sokol_nuklear.h (works in WebGPU, but doesn't contain the work from sokol_imgui.h
to support `unfilterable-float` user textures)

- sokol_gfx_imgui.h gained a new function `sg_imgui_draw_menu()` which renders a
menu panel to show/hide all debug windows. Previously this had to be done
outside the header.

- sokol_gfx_imgui.h gained a new 'frame stats' window, which allows to peak into
sokol_gfx.h frame-rendering internals. This basically visualizes the struct
`sg_frame_stats` returned by the new sokol_gfx.h function `sg_query_frame_stats()`.

- The sokol-samples repository gained 3 new samples:
- cubemap-jpeg-sapp.c (load a cubemap from seperate JPEG files)
- cubemaprt-sapp.c (render into cubemap faces - this demo actually existed a while but wasn't "official" so far)
- drawcallperf-sapp.c (a sample to explore the performance overhead of sg_apply_bindings, sg_apply_uniforms and sg_draw)

#### 03-Oct-2023

- sokol_app.h win/gl: PR https://github.com/floooh/sokol/pull/886 has been merged, this makes
Expand Down
Loading

0 comments on commit a6ccb54

Please sign in to comment.