Skip to content

Commit ef0457d

Browse files
authored
sokol: update to match upstream at c0e0563 (#21971)
1 parent d43f0e4 commit ef0457d

File tree

10 files changed

+1752
-789
lines changed

10 files changed

+1752
-789
lines changed

cmd/tools/vshader.v

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,27 @@ import io.util
1818
import flag
1919
import net.http
2020

21-
const shdc_full_hash = '6b84ea387a323db9e8e17f5abed2b254a6e409fe'
22-
const tool_version = '0.0.3'
21+
const shdc_full_hash = '0d91b038780614a867f2c8eecd7d935d76bcaae3'
22+
const tool_version = '0.0.4'
2323
const tool_description = "Compile shaders in sokol's annotated GLSL format to C headers for use with sokol based apps"
2424
const tool_name = os.file_name(os.executable())
2525
const cache_dir = os.join_path(os.cache_dir(), 'v', tool_name)
2626
const runtime_os = os.user_os()
27-
2827
const supported_hosts = ['linux', 'macos', 'windows']
2928
const supported_slangs = [
30-
'glsl330', // desktop OpenGL backend (SOKOL_GLCORE33)
31-
'glsl100', // OpenGLES2 and WebGL (SOKOL_GLES3)
29+
'glsl430', // default desktop OpenGL backend (SOKOL_GLCORE)
30+
'glsl410', // default macOS desktop OpenGL
3231
'glsl300es', // OpenGLES3 and WebGL2 (SOKOL_GLES3)
3332
'hlsl4', // Direct3D11 with HLSL4 (SOKOL_D3D11)
3433
'hlsl5', // Direct3D11 with HLSL5 (SOKOL_D3D11)
3534
'metal_macos', // Metal on macOS (SOKOL_METAL)
3635
'metal_ios', // Metal on iOS devices (SOKOL_METAL)
3736
'metal_sim', // Metal on iOS simulator (SOKOL_METAL)
3837
'wgsl', // WebGPU (SOKOL_WGPU)
38+
'reflection',
3939
]
4040
const default_slangs = [
41-
'glsl330',
42-
'glsl100',
41+
'glsl410',
4342
'glsl300es',
4443
// 'hlsl4', and hlsl5 can't be used at the same time
4544
'hlsl5',

thirdparty/sokol/sokol_app.h

Lines changed: 765 additions & 436 deletions
Large diffs are not rendered by default.

thirdparty/sokol/sokol_audio.h

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
4040
- on macOS: AudioToolbox
4141
- on iOS: AudioToolbox, AVFoundation
42+
- on FreeBSD: asound
4243
- on Linux: asound
4344
- on Android: link with OpenSLES or aaudio
4445
- on Windows with MSVC or Clang toolchain: no action needed, libs are defined in-source via pragma-comment-lib
@@ -51,6 +52,7 @@
5152
5253
- Windows: WASAPI
5354
- Linux: ALSA
55+
- FreeBSD: ALSA
5456
- macOS: CoreAudio
5557
- iOS: CoreAudio+AVAudioSession
5658
- emscripten: WebAudio with ScriptProcessorNode
@@ -780,13 +782,9 @@ inline void saudio_setup(const saudio_desc& desc) { return saudio_setup(&desc);
780782
#include "aaudio/AAudio.h"
781783
#endif
782784
#elif defined(_SAUDIO_LINUX)
783-
// __v_ start
784-
#if !defined(__FreeBSD__)
785-
// __v_ end
786-
#include <alloca.h>
787-
// __v_ start
788-
#endif
789-
// __v_ end
785+
#if !defined(__FreeBSD__)
786+
#include <alloca.h>
787+
#endif
790788
#define _SAUDIO_PTHREADS (1)
791789
#include <pthread.h>
792790
#define ALSA_PCM_NEW_HW_PARAMS_API
@@ -1069,6 +1067,7 @@ typedef struct {
10691067
/* sokol-audio state */
10701068
typedef struct {
10711069
bool valid;
1070+
bool setup_called;
10721071
void (*stream_cb)(float* buffer, int num_frames, int num_channels);
10731072
void (*stream_userdata_cb)(float* buffer, int num_frames, int num_channels, void* user_data);
10741073
void* user_data;
@@ -2488,9 +2487,11 @@ void _saudio_backend_shutdown(void) {
24882487
// >>public
24892488
SOKOL_API_IMPL void saudio_setup(const saudio_desc* desc) {
24902489
SOKOL_ASSERT(!_saudio.valid);
2490+
SOKOL_ASSERT(!_saudio.setup_called);
24912491
SOKOL_ASSERT(desc);
24922492
SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn));
24932493
_saudio_clear(&_saudio, sizeof(_saudio));
2494+
_saudio.setup_called = true;
24942495
_saudio.desc = *desc;
24952496
_saudio.stream_cb = desc->stream_cb;
24962497
_saudio.stream_userdata_cb = desc->stream_userdata_cb;
@@ -2521,6 +2522,8 @@ SOKOL_API_IMPL void saudio_setup(const saudio_desc* desc) {
25212522
}
25222523

25232524
SOKOL_API_IMPL void saudio_shutdown(void) {
2525+
SOKOL_ASSERT(_saudio.setup_called);
2526+
_saudio.setup_called = false;
25242527
if (_saudio.valid) {
25252528
_saudio_backend_shutdown();
25262529
_saudio_fifo_shutdown(&_saudio.fifo);
@@ -2534,26 +2537,32 @@ SOKOL_API_IMPL bool saudio_isvalid(void) {
25342537
}
25352538

25362539
SOKOL_API_IMPL void* saudio_userdata(void) {
2540+
SOKOL_ASSERT(_saudio.setup_called);
25372541
return _saudio.desc.user_data;
25382542
}
25392543

25402544
SOKOL_API_IMPL saudio_desc saudio_query_desc(void) {
2545+
SOKOL_ASSERT(_saudio.setup_called);
25412546
return _saudio.desc;
25422547
}
25432548

25442549
SOKOL_API_IMPL int saudio_sample_rate(void) {
2550+
SOKOL_ASSERT(_saudio.setup_called);
25452551
return _saudio.sample_rate;
25462552
}
25472553

25482554
SOKOL_API_IMPL int saudio_buffer_frames(void) {
2555+
SOKOL_ASSERT(_saudio.setup_called);
25492556
return _saudio.buffer_frames;
25502557
}
25512558

25522559
SOKOL_API_IMPL int saudio_channels(void) {
2560+
SOKOL_ASSERT(_saudio.setup_called);
25532561
return _saudio.num_channels;
25542562
}
25552563

25562564
SOKOL_API_IMPL bool saudio_suspended(void) {
2565+
SOKOL_ASSERT(_saudio.setup_called);
25572566
#if defined(_SAUDIO_EMSCRIPTEN)
25582567
if (_saudio.valid) {
25592568
return 1 == saudio_js_suspended();
@@ -2567,6 +2576,7 @@ SOKOL_API_IMPL bool saudio_suspended(void) {
25672576
}
25682577

25692578
SOKOL_API_IMPL int saudio_expect(void) {
2579+
SOKOL_ASSERT(_saudio.setup_called);
25702580
if (_saudio.valid) {
25712581
const int num_frames = _saudio_fifo_writable_bytes(&_saudio.fifo) / _saudio.bytes_per_frame;
25722582
return num_frames;
@@ -2577,6 +2587,7 @@ SOKOL_API_IMPL int saudio_expect(void) {
25772587
}
25782588

25792589
SOKOL_API_IMPL int saudio_push(const float* frames, int num_frames) {
2590+
SOKOL_ASSERT(_saudio.setup_called);
25802591
SOKOL_ASSERT(frames && (num_frames > 0));
25812592
if (_saudio.valid) {
25822593
const int num_bytes = num_frames * _saudio.bytes_per_frame;

0 commit comments

Comments
 (0)