Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sokol: update to match upstream at c0e0563 #21971

Merged
merged 3 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions cmd/tools/vshader.v
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,27 @@ import io.util
import flag
import net.http

const shdc_full_hash = '6b84ea387a323db9e8e17f5abed2b254a6e409fe'
const tool_version = '0.0.3'
const shdc_full_hash = '0d91b038780614a867f2c8eecd7d935d76bcaae3'
const tool_version = '0.0.4'
const tool_description = "Compile shaders in sokol's annotated GLSL format to C headers for use with sokol based apps"
const tool_name = os.file_name(os.executable())
const cache_dir = os.join_path(os.cache_dir(), 'v', tool_name)
const runtime_os = os.user_os()

const supported_hosts = ['linux', 'macos', 'windows']
const supported_slangs = [
'glsl330', // desktop OpenGL backend (SOKOL_GLCORE33)
'glsl100', // OpenGLES2 and WebGL (SOKOL_GLES3)
'glsl430', // default desktop OpenGL backend (SOKOL_GLCORE)
'glsl410', // default macOS desktop OpenGL
'glsl300es', // OpenGLES3 and WebGL2 (SOKOL_GLES3)
'hlsl4', // Direct3D11 with HLSL4 (SOKOL_D3D11)
'hlsl5', // Direct3D11 with HLSL5 (SOKOL_D3D11)
'metal_macos', // Metal on macOS (SOKOL_METAL)
'metal_ios', // Metal on iOS devices (SOKOL_METAL)
'metal_sim', // Metal on iOS simulator (SOKOL_METAL)
'wgsl', // WebGPU (SOKOL_WGPU)
'reflection',
]
const default_slangs = [
'glsl330',
'glsl100',
'glsl410',
'glsl300es',
// 'hlsl4', and hlsl5 can't be used at the same time
'hlsl5',
Expand Down
1,201 changes: 765 additions & 436 deletions thirdparty/sokol/sokol_app.h

Large diffs are not rendered by default.

25 changes: 18 additions & 7 deletions thirdparty/sokol/sokol_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

- on macOS: AudioToolbox
- on iOS: AudioToolbox, AVFoundation
- on FreeBSD: asound
- on Linux: asound
- on Android: link with OpenSLES or aaudio
- on Windows with MSVC or Clang toolchain: no action needed, libs are defined in-source via pragma-comment-lib
Expand All @@ -51,6 +52,7 @@

- Windows: WASAPI
- Linux: ALSA
- FreeBSD: ALSA
- macOS: CoreAudio
- iOS: CoreAudio+AVAudioSession
- emscripten: WebAudio with ScriptProcessorNode
Expand Down Expand Up @@ -780,13 +782,9 @@ inline void saudio_setup(const saudio_desc& desc) { return saudio_setup(&desc);
#include "aaudio/AAudio.h"
#endif
#elif defined(_SAUDIO_LINUX)
// __v_ start
#if !defined(__FreeBSD__)
// __v_ end
#include <alloca.h>
// __v_ start
#endif
// __v_ end
#if !defined(__FreeBSD__)
#include <alloca.h>
#endif
#define _SAUDIO_PTHREADS (1)
#include <pthread.h>
#define ALSA_PCM_NEW_HW_PARAMS_API
Expand Down Expand Up @@ -1069,6 +1067,7 @@ typedef struct {
/* sokol-audio state */
typedef struct {
bool valid;
bool setup_called;
void (*stream_cb)(float* buffer, int num_frames, int num_channels);
void (*stream_userdata_cb)(float* buffer, int num_frames, int num_channels, void* user_data);
void* user_data;
Expand Down Expand Up @@ -2488,9 +2487,11 @@ void _saudio_backend_shutdown(void) {
// >>public
SOKOL_API_IMPL void saudio_setup(const saudio_desc* desc) {
SOKOL_ASSERT(!_saudio.valid);
SOKOL_ASSERT(!_saudio.setup_called);
SOKOL_ASSERT(desc);
SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn));
_saudio_clear(&_saudio, sizeof(_saudio));
_saudio.setup_called = true;
_saudio.desc = *desc;
_saudio.stream_cb = desc->stream_cb;
_saudio.stream_userdata_cb = desc->stream_userdata_cb;
Expand Down Expand Up @@ -2521,6 +2522,8 @@ SOKOL_API_IMPL void saudio_setup(const saudio_desc* desc) {
}

SOKOL_API_IMPL void saudio_shutdown(void) {
SOKOL_ASSERT(_saudio.setup_called);
_saudio.setup_called = false;
if (_saudio.valid) {
_saudio_backend_shutdown();
_saudio_fifo_shutdown(&_saudio.fifo);
Expand All @@ -2534,26 +2537,32 @@ SOKOL_API_IMPL bool saudio_isvalid(void) {
}

SOKOL_API_IMPL void* saudio_userdata(void) {
SOKOL_ASSERT(_saudio.setup_called);
return _saudio.desc.user_data;
}

SOKOL_API_IMPL saudio_desc saudio_query_desc(void) {
SOKOL_ASSERT(_saudio.setup_called);
return _saudio.desc;
}

SOKOL_API_IMPL int saudio_sample_rate(void) {
SOKOL_ASSERT(_saudio.setup_called);
return _saudio.sample_rate;
}

SOKOL_API_IMPL int saudio_buffer_frames(void) {
SOKOL_ASSERT(_saudio.setup_called);
return _saudio.buffer_frames;
}

SOKOL_API_IMPL int saudio_channels(void) {
SOKOL_ASSERT(_saudio.setup_called);
return _saudio.num_channels;
}

SOKOL_API_IMPL bool saudio_suspended(void) {
SOKOL_ASSERT(_saudio.setup_called);
#if defined(_SAUDIO_EMSCRIPTEN)
if (_saudio.valid) {
return 1 == saudio_js_suspended();
Expand All @@ -2567,6 +2576,7 @@ SOKOL_API_IMPL bool saudio_suspended(void) {
}

SOKOL_API_IMPL int saudio_expect(void) {
SOKOL_ASSERT(_saudio.setup_called);
if (_saudio.valid) {
const int num_frames = _saudio_fifo_writable_bytes(&_saudio.fifo) / _saudio.bytes_per_frame;
return num_frames;
Expand All @@ -2577,6 +2587,7 @@ SOKOL_API_IMPL int saudio_expect(void) {
}

SOKOL_API_IMPL int saudio_push(const float* frames, int num_frames) {
SOKOL_ASSERT(_saudio.setup_called);
SOKOL_ASSERT(frames && (num_frames > 0));
if (_saudio.valid) {
const int num_bytes = num_frames * _saudio.bytes_per_frame;
Expand Down
Loading
Loading