mirror of
https://github.com/vlang/v.git
synced 2025-08-04 02:07:28 -04:00
sokol: update to match upstream at c0e0563 (#21971)
This commit is contained in:
parent
d43f0e457c
commit
ef0457d6e3
@ -18,17 +18,16 @@ 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)
|
||||
@ -36,10 +35,10 @@ const supported_slangs = [
|
||||
'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',
|
||||
|
1201
thirdparty/sokol/sokol_app.h
vendored
1201
thirdparty/sokol/sokol_app.h
vendored
File diff suppressed because it is too large
Load Diff
25
thirdparty/sokol/sokol_audio.h
vendored
25
thirdparty/sokol/sokol_audio.h
vendored
@ -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
|
||||
@ -51,6 +52,7 @@
|
||||
|
||||
- Windows: WASAPI
|
||||
- Linux: ALSA
|
||||
- FreeBSD: ALSA
|
||||
- macOS: CoreAudio
|
||||
- iOS: CoreAudio+AVAudioSession
|
||||
- emscripten: WebAudio with ScriptProcessorNode
|
||||
@ -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
|
||||
@ -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;
|
||||
@ -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;
|
||||
@ -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);
|
||||
@ -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();
|
||||
@ -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;
|
||||
@ -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;
|
||||
|
1031
thirdparty/sokol/sokol_gfx.h
vendored
1031
thirdparty/sokol/sokol_gfx.h
vendored
File diff suppressed because it is too large
Load Diff
2
thirdparty/sokol/sokol_v.post.h
vendored
2
thirdparty/sokol/sokol_v.post.h
vendored
@ -1,4 +1,4 @@
|
||||
#if defined(SOKOL_GLCORE33) || defined(SOKOL_GLES2) || defined(SOKOL_GLES3)
|
||||
#if defined(SOKOL_GLCORE) || defined(SOKOL_GLES3)
|
||||
void v_sapp_gl_read_rgba_pixels(int x, int y, int width, int height, unsigned char* pixels) {
|
||||
glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
}
|
||||
|
118
thirdparty/sokol/util/sokol_fontstash.h
vendored
118
thirdparty/sokol/util/sokol_fontstash.h
vendored
@ -19,7 +19,7 @@
|
||||
platform-specific embedded shader code (these are the same defines as
|
||||
used by sokol_gfx.h and sokol_app.h):
|
||||
|
||||
SOKOL_GLCORE33
|
||||
SOKOL_GLCORE
|
||||
SOKOL_GLES3
|
||||
SOKOL_D3D11
|
||||
SOKOL_METAL
|
||||
@ -278,11 +278,11 @@ SOKOL_FONTSTASH_API_DECL uint32_t sfons_rgba(uint8_t r, uint8_t g, uint8_t b, ui
|
||||
#define _SOKOL_UNUSED(x) (void)(x)
|
||||
#endif
|
||||
|
||||
#if defined(SOKOL_GLCORE33)
|
||||
#if defined(SOKOL_GLCORE)
|
||||
/*
|
||||
Embedded source code compiled with:
|
||||
|
||||
sokol-shdc -i sfons.glsl -o sfons.h -l glsl330:glsl300es:hlsl4:metal_macos:metal_ios:metal_sim:wgsl -b
|
||||
sokol-shdc -i sfons.glsl -o sfons.h -l glsl410:glsl300es:hlsl4:metal_macos:metal_ios:metal_sim:wgsl -b
|
||||
|
||||
(not that for Metal and D3D11 byte code, sokol-shdc must be run
|
||||
on macOS and Windows)
|
||||
@ -321,55 +321,61 @@ SOKOL_FONTSTASH_API_DECL uint32_t sfons_rgba(uint8_t r, uint8_t g, uint8_t b, ui
|
||||
|
||||
@program sfontstash vs fs
|
||||
*/
|
||||
static const char _sfons_vs_source_glsl330[478] = {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e,
|
||||
static const uint8_t _sfons_vs_source_glsl410[520] = {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
|
||||
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x73,0x5b,0x38,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,
|
||||
0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,
|
||||
0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,
|
||||
0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,
|
||||
0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x73,
|
||||
0x69,0x7a,0x65,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x76,
|
||||
0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,
|
||||
0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x74,
|
||||
0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,
|
||||
0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
|
||||
0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,
|
||||
0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x0a,
|
||||
0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
||||
0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,
|
||||
0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,
|
||||
0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,
|
||||
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x70,
|
||||
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,
|
||||
0x50,0x6f,0x69,0x6e,0x74,0x53,0x69,0x7a,0x65,0x20,0x3d,0x20,0x70,0x73,0x69,0x7a,
|
||||
0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,
|
||||
0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2c,0x20,0x76,
|
||||
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2c,0x20,0x76,0x73,0x5f,
|
||||
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,
|
||||
0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,
|
||||
0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,
|
||||
0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
0x69,0x7a,0x65,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
|
||||
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,
|
||||
0x63,0x34,0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,
|
||||
0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,
|
||||
0x65,0x63,0x32,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x6c,
|
||||
0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,
|
||||
0x20,0x31,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,
|
||||
0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,
|
||||
0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,
|
||||
0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,
|
||||
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,
|
||||
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,
|
||||
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,
|
||||
0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
|
||||
0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74,0x53,
|
||||
0x69,0x7a,0x65,0x20,0x3d,0x20,0x70,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x75,0x76,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,
|
||||
0x6d,0x73,0x5b,0x35,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
|
||||
0x5b,0x36,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x37,
|
||||
0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x74,0x65,0x78,0x63,0x6f,0x6f,
|
||||
0x72,0x64,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,
|
||||
0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
};
|
||||
static const char _sfons_fs_source_glsl330[203] = {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e,
|
||||
static const uint8_t _sfons_fs_source_glsl410[245] = {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
|
||||
0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,
|
||||
0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
|
||||
0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,
|
||||
0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
|
||||
0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x76,0x3b,0x0a,
|
||||
0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,
|
||||
0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,
|
||||
0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,
|
||||
0x30,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,
|
||||
0x6d,0x70,0x2c,0x20,0x75,0x76,0x2e,0x78,0x79,0x29,0x2e,0x78,0x29,0x20,0x2a,0x20,
|
||||
0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,
|
||||
0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,
|
||||
0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
|
||||
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,
|
||||
0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,
|
||||
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x31,0x2e,
|
||||
0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x74,0x65,0x78,
|
||||
0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,
|
||||
0x2e,0x78,0x79,0x29,0x2e,0x78,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,
|
||||
0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
};
|
||||
#elif defined(SOKOL_GLES3)
|
||||
static const char _sfons_vs_source_glsl300es[481] = {
|
||||
static const uint8_t _sfons_vs_source_glsl300es[481] = {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
|
||||
0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,
|
||||
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x38,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,
|
||||
@ -402,7 +408,7 @@ static const char _sfons_vs_source_glsl300es[481] = {
|
||||
0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,
|
||||
0x00,
|
||||
};
|
||||
static const char _sfons_fs_source_glsl300es[276] = {
|
||||
static const uint8_t _sfons_fs_source_glsl300es[276] = {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
|
||||
0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,
|
||||
0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69,
|
||||
@ -1204,7 +1210,7 @@ static const uint8_t _sfons_fs_bytecode_metal_ios[2841] = {
|
||||
0xc8,0x70,0x04,0x8d,0x05,0x91,0x7c,0x66,0x1b,0x94,0x00,0xc8,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
static const char _sfons_vs_source_metal_sim[756] = {
|
||||
static const uint8_t _sfons_vs_source_metal_sim[756] = {
|
||||
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
||||
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
||||
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
||||
@ -1254,7 +1260,7 @@ static const char _sfons_vs_source_metal_sim[756] = {
|
||||
0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,
|
||||
0x7d,0x0a,0x0a,0x00,
|
||||
};
|
||||
static const char _sfons_fs_source_metal_sim[464] = {
|
||||
static const uint8_t _sfons_fs_source_metal_sim[464] = {
|
||||
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
||||
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
||||
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
||||
@ -1397,7 +1403,7 @@ static const uint8_t _sfons_fs_bytecode_hlsl4[628] = {
|
||||
0x00,0x00,0x00,0x00,
|
||||
};
|
||||
#elif defined(SOKOL_WGPU)
|
||||
static const char _sfons_vs_source_wgsl[1162] = {
|
||||
static const uint8_t _sfons_vs_source_wgsl[1162] = {
|
||||
0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20,
|
||||
0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f,
|
||||
0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,
|
||||
@ -1472,17 +1478,17 @@ static const char _sfons_vs_source_wgsl[1162] = {
|
||||
0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x75,0x76,0x2c,0x20,0x63,0x6f,
|
||||
0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
};
|
||||
static const char _sfons_fs_source_wgsl[674] = {
|
||||
static const uint8_t _sfons_fs_source_wgsl[674] = {
|
||||
0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20,
|
||||
0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f,
|
||||
0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,
|
||||
0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
|
||||
0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,
|
||||
0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x33,0x32,
|
||||
0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x38,
|
||||
0x29,0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x74,0x65,0x78,0x74,
|
||||
0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x67,
|
||||
0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,
|
||||
0x28,0x34,0x38,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,
|
||||
0x28,0x36,0x34,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,
|
||||
0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,
|
||||
0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,
|
||||
0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,
|
||||
@ -1521,7 +1527,7 @@ static const char _sfons_fs_source_wgsl[674] = {
|
||||
static const char* _sfons_vs_source_dummy = "";
|
||||
static const char* _sfons_fs_source_dummy = "";
|
||||
#else
|
||||
#error "Please define one of SOKOL_GLCORE33, SOKOL_GLES3, SOKOL_D3D11, SOKOL_METAL, SOKOL_WGPU or SOKOL_DUMMY_BACKEND!"
|
||||
#error "Please define one of SOKOL_GLCORE, SOKOL_GLES3, SOKOL_D3D11, SOKOL_METAL, SOKOL_WGPU or SOKOL_DUMMY_BACKEND!"
|
||||
#endif
|
||||
|
||||
typedef struct _sfons_t {
|
||||
@ -1601,12 +1607,12 @@ static int _sfons_render_create(void* user_ptr, int width, int height) {
|
||||
shd_desc.fs.image_sampler_pairs[0].image_slot = 0;
|
||||
shd_desc.fs.image_sampler_pairs[0].sampler_slot = 0;
|
||||
shd_desc.label = "sokol-fontstash-shader";
|
||||
#if defined(SOKOL_GLCORE33)
|
||||
shd_desc.vs.source = _sfons_vs_source_glsl330;
|
||||
shd_desc.fs.source = _sfons_fs_source_glsl330;
|
||||
#if defined(SOKOL_GLCORE)
|
||||
shd_desc.vs.source = (const char*)_sfons_vs_source_glsl410;
|
||||
shd_desc.fs.source = (const char*)_sfons_fs_source_glsl410;
|
||||
#elif defined(SOKOL_GLES3)
|
||||
shd_desc.vs.source = _sfons_vs_source_glsl300es;
|
||||
shd_desc.fs.source = _sfons_fs_source_glsl300es;
|
||||
shd_desc.vs.source = (const char*)_sfons_vs_source_glsl300es;
|
||||
shd_desc.fs.source = (const char*)_sfons_fs_source_glsl300es;
|
||||
#elif defined(SOKOL_METAL)
|
||||
shd_desc.vs.entry = "main0";
|
||||
shd_desc.fs.entry = "main0";
|
||||
@ -1620,16 +1626,16 @@ static int _sfons_render_create(void* user_ptr, int width, int height) {
|
||||
shd_desc.fs.bytecode = SG_RANGE(_sfons_fs_bytecode_metal_ios);
|
||||
break;
|
||||
default:
|
||||
shd_desc.vs.source = _sfons_vs_source_metal_sim;
|
||||
shd_desc.fs.source = _sfons_fs_source_metal_sim;
|
||||
shd_desc.vs.source = (const char*)_sfons_vs_source_metal_sim;
|
||||
shd_desc.fs.source = (const char*)_sfons_fs_source_metal_sim;
|
||||
break;
|
||||
}
|
||||
#elif defined(SOKOL_D3D11)
|
||||
shd_desc.vs.bytecode = SG_RANGE(_sfons_vs_bytecode_hlsl4);
|
||||
shd_desc.fs.bytecode = SG_RANGE(_sfons_fs_bytecode_hlsl4);
|
||||
#elif defined(SOKOL_WGPU)
|
||||
shd_desc.vs.source = _sfons_vs_source_wgsl;
|
||||
shd_desc.fs.source = _sfons_fs_source_wgsl;
|
||||
shd_desc.vs.source = (const char*)_sfons_vs_source_wgsl;
|
||||
shd_desc.fs.source = (const char*)_sfons_fs_source_wgsl;
|
||||
#else
|
||||
shd_desc.vs.source = _sfons_vs_source_dummy;
|
||||
shd_desc.fs.source = _sfons_fs_source_dummy;
|
||||
|
115
thirdparty/sokol/util/sokol_gl.h
vendored
115
thirdparty/sokol/util/sokol_gl.h
vendored
@ -17,7 +17,7 @@
|
||||
platform-specific embedded shader code (these are the same defines as
|
||||
used by sokol_gfx.h and sokol_app.h):
|
||||
|
||||
SOKOL_GLCORE33
|
||||
SOKOL_GLCORE
|
||||
SOKOL_GLES3
|
||||
SOKOL_D3D11
|
||||
SOKOL_METAL
|
||||
@ -973,7 +973,7 @@ inline sgl_pipeline sgl_context_make_pipeline(sgl_context ctx, const sg_pipeline
|
||||
/*
|
||||
Embedded source code compiled with:
|
||||
|
||||
sokol-shdc -i sgl.glsl -o sgl.h -l glsl330:glsl300es:hlsl4:metal_macos:metal_ios:metal_sim:wgpu -b
|
||||
sokol-shdc -i sgl.glsl -o sgl.h -l glsl410:glsl300es:hlsl4:metal_macos:metal_ios:metal_sim:wgpu -b
|
||||
|
||||
(not that for Metal and D3D11 byte code, sokol-shdc must be run
|
||||
on macOS and Windows)
|
||||
@ -1013,55 +1013,60 @@ inline sgl_pipeline sgl_context_make_pipeline(sgl_context ctx, const sg_pipeline
|
||||
@program sgl vs fs
|
||||
*/
|
||||
|
||||
#if defined(SOKOL_GLCORE33)
|
||||
static const char _sgl_vs_source_glsl330[478] = {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e,
|
||||
#if defined(SOKOL_GLCORE)
|
||||
static const uint8_t _sgl_vs_source_glsl410[520] = {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
|
||||
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x73,0x5b,0x38,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,
|
||||
0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,
|
||||
0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,
|
||||
0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,
|
||||
0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x73,
|
||||
0x69,0x7a,0x65,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x76,
|
||||
0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,
|
||||
0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x74,
|
||||
0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,
|
||||
0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
|
||||
0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,
|
||||
0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x0a,
|
||||
0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
||||
0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,
|
||||
0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,
|
||||
0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,
|
||||
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x70,
|
||||
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,
|
||||
0x50,0x6f,0x69,0x6e,0x74,0x53,0x69,0x7a,0x65,0x20,0x3d,0x20,0x70,0x73,0x69,0x7a,
|
||||
0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,
|
||||
0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2c,0x20,0x76,
|
||||
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2c,0x20,0x76,0x73,0x5f,
|
||||
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,
|
||||
0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,
|
||||
0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,
|
||||
0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
0x69,0x7a,0x65,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
|
||||
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,
|
||||
0x63,0x34,0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,
|
||||
0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,
|
||||
0x65,0x63,0x32,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x6c,
|
||||
0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,
|
||||
0x20,0x31,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,
|
||||
0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,
|
||||
0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,
|
||||
0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,
|
||||
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,
|
||||
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,
|
||||
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,
|
||||
0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
|
||||
0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x69,0x6e,0x74,0x53,
|
||||
0x69,0x7a,0x65,0x20,0x3d,0x20,0x70,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x75,0x76,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,
|
||||
0x6d,0x73,0x5b,0x35,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
|
||||
0x5b,0x36,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x37,
|
||||
0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x74,0x65,0x78,0x63,0x6f,0x6f,
|
||||
0x72,0x64,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,
|
||||
0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
};
|
||||
static const char _sgl_fs_source_glsl330[180] = {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e,
|
||||
static const uint8_t _sgl_fs_source_glsl410[222] = {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
|
||||
0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,
|
||||
0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
|
||||
0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,
|
||||
0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
|
||||
0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x75,0x76,0x3b,0x0a,
|
||||
0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,
|
||||
0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,
|
||||
0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,
|
||||
0x75,0x76,0x2e,0x78,0x79,0x29,0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,
|
||||
0x7d,0x0a,0x0a,0x00,
|
||||
0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,
|
||||
0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,
|
||||
0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
|
||||
0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,
|
||||
0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,
|
||||
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,
|
||||
0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x2e,0x78,0x79,0x29,
|
||||
0x20,0x2a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
};
|
||||
#elif defined(SOKOL_GLES3)
|
||||
static const char _sgl_vs_source_glsl300es[481] = {
|
||||
static const uint8_t _sgl_vs_source_glsl300es[481] = {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
|
||||
0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,
|
||||
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x38,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,
|
||||
@ -1094,7 +1099,7 @@ static const char _sgl_vs_source_glsl300es[481] = {
|
||||
0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,
|
||||
0x00,
|
||||
};
|
||||
static const char _sgl_fs_source_glsl300es[253] = {
|
||||
static const uint8_t _sgl_fs_source_glsl300es[253] = {
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
|
||||
0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,
|
||||
0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69,
|
||||
@ -1890,7 +1895,7 @@ static const uint8_t _sgl_fs_bytecode_metal_ios[2809] = {
|
||||
0x42,0x40,0x29,0x49,0x50,0x20,0x86,0x60,0x01,0x23,0x9f,0xd9,0x06,0x23,0x00,0x32,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
static const char _sgl_vs_source_metal_sim[756] = {
|
||||
static const uint8_t _sgl_vs_source_metal_sim[756] = {
|
||||
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
||||
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
||||
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
||||
@ -1940,7 +1945,7 @@ static const char _sgl_vs_source_metal_sim[756] = {
|
||||
0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,
|
||||
0x7d,0x0a,0x0a,0x00,
|
||||
};
|
||||
static const char _sgl_fs_source_metal_sim[439] = {
|
||||
static const uint8_t _sgl_fs_source_metal_sim[439] = {
|
||||
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
||||
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
||||
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
||||
@ -2080,7 +2085,7 @@ static const uint8_t _sgl_fs_bytecode_hlsl4[608] = {
|
||||
|
||||
};
|
||||
#elif defined(SOKOL_WGPU)
|
||||
static const char _sgl_vs_source_wgsl[1162] = {
|
||||
static const uint8_t _sgl_vs_source_wgsl[1162] = {
|
||||
0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20,
|
||||
0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f,
|
||||
0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,
|
||||
@ -2155,17 +2160,17 @@ static const char _sgl_vs_source_wgsl[1162] = {
|
||||
0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x75,0x76,0x2c,0x20,0x63,0x6f,
|
||||
0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
};
|
||||
static const char _sgl_fs_source_wgsl[647] = {
|
||||
static const uint8_t _sgl_fs_source_wgsl[647] = {
|
||||
0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20,
|
||||
0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f,
|
||||
0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,
|
||||
0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
|
||||
0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,
|
||||
0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x33,0x32,
|
||||
0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x38,
|
||||
0x29,0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x74,0x65,0x78,0x74,
|
||||
0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x67,
|
||||
0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,
|
||||
0x28,0x34,0x38,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,
|
||||
0x28,0x36,0x34,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,
|
||||
0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,
|
||||
0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,
|
||||
0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,
|
||||
@ -2202,7 +2207,7 @@ static const char _sgl_fs_source_wgsl[647] = {
|
||||
static const char* _sgl_vs_source_dummy = "";
|
||||
static const char* _sgl_fs_source_dummy = "";
|
||||
#else
|
||||
#error "Please define one of SOKOL_GLCORE33, SOKOL_GLES3, SOKOL_D3D11, SOKOL_METAL, SOKOL_WGPU or SOKOL_DUMMY_BACKEND!"
|
||||
#error "Please define one of SOKOL_GLCORE, SOKOL_GLES3, SOKOL_D3D11, SOKOL_METAL, SOKOL_WGPU or SOKOL_DUMMY_BACKEND!"
|
||||
#endif
|
||||
|
||||
// ████████ ██ ██ ██████ ███████ ███████
|
||||
@ -3286,12 +3291,12 @@ static void _sgl_setup_common(void) {
|
||||
shd_desc.fs.image_sampler_pairs[0].sampler_slot = 0;
|
||||
shd_desc.fs.image_sampler_pairs[0].glsl_name = "tex_smp";
|
||||
shd_desc.label = "sgl-shader";
|
||||
#if defined(SOKOL_GLCORE33)
|
||||
shd_desc.vs.source = _sgl_vs_source_glsl330;
|
||||
shd_desc.fs.source = _sgl_fs_source_glsl330;
|
||||
#if defined(SOKOL_GLCORE)
|
||||
shd_desc.vs.source = (const char*)_sgl_vs_source_glsl410;
|
||||
shd_desc.fs.source = (const char*)_sgl_fs_source_glsl410;
|
||||
#elif defined(SOKOL_GLES3)
|
||||
shd_desc.vs.source = _sgl_vs_source_glsl300es;
|
||||
shd_desc.fs.source = _sgl_fs_source_glsl300es;
|
||||
shd_desc.vs.source = (const char*)_sgl_vs_source_glsl300es;
|
||||
shd_desc.fs.source = (const char*)_sgl_fs_source_glsl300es;
|
||||
#elif defined(SOKOL_METAL)
|
||||
shd_desc.vs.entry = "main0";
|
||||
shd_desc.fs.entry = "main0";
|
||||
@ -3305,16 +3310,16 @@ static void _sgl_setup_common(void) {
|
||||
shd_desc.fs.bytecode = SG_RANGE(_sgl_fs_bytecode_metal_ios);
|
||||
break;
|
||||
default:
|
||||
shd_desc.vs.source = _sgl_vs_source_metal_sim;
|
||||
shd_desc.fs.source = _sgl_fs_source_metal_sim;
|
||||
shd_desc.vs.source = (const char*)_sgl_vs_source_metal_sim;
|
||||
shd_desc.fs.source = (const char*)_sgl_fs_source_metal_sim;
|
||||
break;
|
||||
}
|
||||
#elif defined(SOKOL_D3D11)
|
||||
shd_desc.vs.bytecode = SG_RANGE(_sgl_vs_bytecode_hlsl4);
|
||||
shd_desc.fs.bytecode = SG_RANGE(_sgl_fs_bytecode_hlsl4);
|
||||
#elif defined(SOKOL_WGPU)
|
||||
shd_desc.vs.source = _sgl_vs_source_wgsl;
|
||||
shd_desc.fs.source = _sgl_fs_source_wgsl;
|
||||
shd_desc.vs.source = (const char*)_sgl_vs_source_wgsl;
|
||||
shd_desc.fs.source = (const char*)_sgl_fs_source_wgsl;
|
||||
#else
|
||||
shd_desc.vs.source = _sgl_vs_source_dummy;
|
||||
shd_desc.fs.source = _sgl_fs_source_dummy;
|
||||
|
@ -26,7 +26,7 @@ $if !tinyc {
|
||||
// METAL
|
||||
$if macos {
|
||||
$if darwin_sokol_glcore33 ? {
|
||||
#flag darwin -DSOKOL_GLCORE33 -framework OpenGL -framework Cocoa -framework QuartzCore
|
||||
#flag darwin -DSOKOL_GLCORE -framework OpenGL -framework Cocoa -framework QuartzCore
|
||||
} $else {
|
||||
#flag -DSOKOL_METAL
|
||||
#flag -framework Metal -framework Cocoa -framework MetalKit -framework QuartzCore
|
||||
@ -47,12 +47,12 @@ $if emscripten ? {
|
||||
}
|
||||
|
||||
// OPENGL
|
||||
#flag linux -DSOKOL_GLCORE33
|
||||
#flag freebsd -DSOKOL_GLCORE33
|
||||
#flag openbsd -DSOKOL_GLCORE33
|
||||
#flag linux -DSOKOL_GLCORE
|
||||
#flag freebsd -DSOKOL_GLCORE
|
||||
#flag openbsd -DSOKOL_GLCORE
|
||||
//#flag darwin -framework OpenGL -framework Cocoa -framework QuartzCore
|
||||
// D3D
|
||||
#flag windows -DSOKOL_GLCORE33
|
||||
#flag windows -DSOKOL_GLCORE
|
||||
//#flag windows -DSOKOL_D3D11
|
||||
// for simplicity, all header includes are here because import order matters and we dont have any way
|
||||
// to ensure import order with V yet
|
||||
|
@ -88,9 +88,10 @@ pub enum PixelFormat as u32 {
|
||||
etc2_rgb8a1
|
||||
etc2_rgba8
|
||||
etc2_srgb8a8
|
||||
etc2_rg11
|
||||
etc2_rg11sn
|
||||
//
|
||||
eac_r11
|
||||
eac_r11sn
|
||||
eac_rg11
|
||||
eac_rg11sn
|
||||
astc_4x4_rgba
|
||||
astc_4x4_srgba
|
||||
//
|
||||
@ -120,8 +121,9 @@ pub enum BufferType as u32 {
|
||||
_default // value 0 reserved for default-init
|
||||
vertexbuffer
|
||||
indexbuffer
|
||||
storagebuffer
|
||||
_num
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
_force_u32 = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
pub enum IndexType as u32 {
|
||||
|
@ -254,6 +254,7 @@ pub mut:
|
||||
entry &char
|
||||
d3d11_target &char
|
||||
uniform_blocks [4]ShaderUniformBlockDesc
|
||||
storage_buffers [8]ShaderStorageBufferDesc
|
||||
images [12]ShaderImageDesc
|
||||
samplers [8]ShaderSamplerDesc
|
||||
image_sampler_pairs [12]ShaderImageSamplerPairDesc
|
||||
@ -296,6 +297,14 @@ pub mut:
|
||||
|
||||
pub type ShaderImageDesc = C.sg_shader_image_desc
|
||||
|
||||
pub struct C.sg_shader_storage_buffer_desc {
|
||||
pub mut:
|
||||
used bool
|
||||
readonly bool
|
||||
}
|
||||
|
||||
pub type ShaderStorageBufferDesc = C.sg_shader_storage_buffer_desc
|
||||
|
||||
pub struct C.sg_shader_sampler_desc {
|
||||
pub mut:
|
||||
used bool
|
||||
@ -461,6 +470,7 @@ pub struct C.sg_frame_stats_metal_bindings {
|
||||
num_set_vertex_buffer u32
|
||||
num_set_vertex_texture u32
|
||||
num_set_vertex_sampler_state u32
|
||||
num_set_fragment_buffer u32
|
||||
num_set_fragment_texture u32
|
||||
num_set_fragment_sampler_state u32
|
||||
}
|
||||
@ -770,11 +780,7 @@ pub:
|
||||
image_clamp_to_border bool // border color and clamp-to-border UV-wrap mode is supported
|
||||
mrt_independent_blend_state bool // multiple-render-target rendering can use per-render-target blend state
|
||||
mrt_independent_write_mask bool // multiple-render-target rendering can use per-render-target color write masks
|
||||
// instancing bool // hardware instancing supported
|
||||
// multiple_render_targets bool // offscreen render passes can have multiple render targets attached
|
||||
// msaa_render_targets bool // offscreen render passes support MSAA antialiasing
|
||||
// imagetype_3d bool // creation of SG_IMAGETYPE_3D images is supported
|
||||
// imagetype_array bool // creation of SG_IMAGETYPE_ARRAY images is supported
|
||||
storage_buffer bool // storage buffers are supported
|
||||
}
|
||||
|
||||
pub type Features = C.sg_features
|
||||
|
Loading…
x
Reference in New Issue
Block a user