Update sokol gfx
This commit is contained in:
parent
d43d9d8fe3
commit
011d1d99d5
|
@ -786,22 +786,31 @@ JSC_CCALL(render_pipeline,
|
||||||
)
|
)
|
||||||
|
|
||||||
JSC_CCALL(render_setuniv,
|
JSC_CCALL(render_setuniv,
|
||||||
float f = js2number(argv[2]);
|
HMM_Vec4 f = {0};
|
||||||
|
f.x = js2number(argv[2]);
|
||||||
sg_apply_uniforms(js2number(argv[0]), js2number(argv[1]), SG_RANGE_REF(f));
|
sg_apply_uniforms(js2number(argv[0]), js2number(argv[1]), SG_RANGE_REF(f));
|
||||||
)
|
)
|
||||||
|
|
||||||
JSC_CCALL(render_setuniv2,
|
JSC_CCALL(render_setuniv2,
|
||||||
HMM_Vec2 v = js2vec2(argv[2]);
|
HMM_Vec4 v;
|
||||||
|
v.xy = js2vec2(argv[2]);
|
||||||
sg_apply_uniforms(js2number(argv[0]), js2number(argv[1]), SG_RANGE_REF(v.e));
|
sg_apply_uniforms(js2number(argv[0]), js2number(argv[1]), SG_RANGE_REF(v.e));
|
||||||
)
|
)
|
||||||
|
|
||||||
JSC_CCALL(render_setuniv3,
|
JSC_CCALL(render_setuniv3,
|
||||||
HMM_Vec3 v = js2vec3(argv[2]);
|
HMM_Vec4 f = {0};
|
||||||
sg_apply_uniforms(js2number(argv[0]), js2number(argv[1]), SG_RANGE_REF(v.e));
|
f.xyz = js2vec3(argv[2]);
|
||||||
|
sg_apply_uniforms(js2number(argv[0]), js2number(argv[1]), SG_RANGE_REF(f.e));
|
||||||
)
|
)
|
||||||
|
|
||||||
JSC_CCALL(render_setuniv4,
|
JSC_CCALL(render_setuniv4,
|
||||||
HMM_Vec4 v = js2vec4(argv[2]);
|
HMM_Vec4 v = {0};
|
||||||
|
if (JS_IsArray(js, argv[2])) {
|
||||||
|
for (int i = 0; i < js_arrlen(argv[2]); i++)
|
||||||
|
v.e[i] = js2number(js_getpropidx(argv[2], i));
|
||||||
|
} else
|
||||||
|
v.x = js2number(argv[2]);
|
||||||
|
|
||||||
sg_apply_uniforms(js2number(argv[0]), js2number(argv[1]), SG_RANGE_REF(v.e));
|
sg_apply_uniforms(js2number(argv[0]), js2number(argv[1]), SG_RANGE_REF(v.e));
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
103
source/engine/thirdparty/sokol/sokol_app.h
vendored
103
source/engine/thirdparty/sokol/sokol_app.h
vendored
|
@ -18,11 +18,12 @@
|
||||||
the backend selected for sokol_gfx.h if both are used in the same
|
the backend selected for sokol_gfx.h if both are used in the same
|
||||||
project):
|
project):
|
||||||
|
|
||||||
#define SOKOL_GLCORE33
|
#define SOKOL_GLCORE
|
||||||
#define SOKOL_GLES3
|
#define SOKOL_GLES3
|
||||||
#define SOKOL_D3D11
|
#define SOKOL_D3D11
|
||||||
#define SOKOL_METAL
|
#define SOKOL_METAL
|
||||||
#define SOKOL_WGPU
|
#define SOKOL_WGPU
|
||||||
|
#define SOKOL_NOAPI
|
||||||
|
|
||||||
Optionally provide the following defines with your own implementations:
|
Optionally provide the following defines with your own implementations:
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@
|
||||||
On Windows, SOKOL_DLL will define SOKOL_APP_API_DECL as __declspec(dllexport)
|
On Windows, SOKOL_DLL will define SOKOL_APP_API_DECL as __declspec(dllexport)
|
||||||
or __declspec(dllimport) as needed.
|
or __declspec(dllimport) as needed.
|
||||||
|
|
||||||
On Linux, SOKOL_GLCORE33 can use either GLX or EGL.
|
On Linux, SOKOL_GLCORE can use either GLX or EGL.
|
||||||
GLX is default, set SOKOL_FORCE_EGL to override.
|
GLX is default, set SOKOL_FORCE_EGL to override.
|
||||||
|
|
||||||
For example code, see https://github.com/floooh/sokol-samples/tree/master/sapp
|
For example code, see https://github.com/floooh/sokol-samples/tree/master/sapp
|
||||||
|
@ -87,7 +88,7 @@
|
||||||
- makes the rendered frame visible
|
- makes the rendered frame visible
|
||||||
- provides keyboard-, mouse- and low-level touch-events
|
- provides keyboard-, mouse- and low-level touch-events
|
||||||
- platforms: MacOS, iOS, HTML5, Win32, Linux/RaspberryPi, Android
|
- platforms: MacOS, iOS, HTML5, Win32, Linux/RaspberryPi, Android
|
||||||
- 3D-APIs: Metal, D3D11, GL3.2, GLES3, WebGL, WebGL2
|
- 3D-APIs: Metal, D3D11, GL3.2, GLES3, WebGL, WebGL2, NOAPI
|
||||||
|
|
||||||
FEATURE/PLATFORM MATRIX
|
FEATURE/PLATFORM MATRIX
|
||||||
=======================
|
=======================
|
||||||
|
@ -97,6 +98,7 @@
|
||||||
gles3/webgl2 | --- | --- | YES(2)| YES | YES | YES
|
gles3/webgl2 | --- | --- | YES(2)| YES | YES | YES
|
||||||
metal | --- | YES | --- | YES | --- | ---
|
metal | --- | YES | --- | YES | --- | ---
|
||||||
d3d11 | YES | --- | --- | --- | --- | ---
|
d3d11 | YES | --- | --- | --- | --- | ---
|
||||||
|
noapi | YES | TODO | TODO | --- | TODO | ---
|
||||||
KEY_DOWN | YES | YES | YES | SOME | TODO | YES
|
KEY_DOWN | YES | YES | YES | SOME | TODO | YES
|
||||||
KEY_UP | YES | YES | YES | SOME | TODO | YES
|
KEY_UP | YES | YES | YES | SOME | TODO | YES
|
||||||
CHAR | YES | YES | YES | YES | TODO | YES
|
CHAR | YES | YES | YES | YES | TODO | YES
|
||||||
|
@ -313,10 +315,15 @@
|
||||||
objects and values required for rendering. If sokol_app.h
|
objects and values required for rendering. If sokol_app.h
|
||||||
is not compiled with SOKOL_WGPU, these functions return null.
|
is not compiled with SOKOL_WGPU, these functions return null.
|
||||||
|
|
||||||
const uint32_t sapp_gl_get_framebuffer(void)
|
uint32_t sapp_gl_get_framebuffer(void)
|
||||||
This returns the 'default framebuffer' of the GL context.
|
This returns the 'default framebuffer' of the GL context.
|
||||||
Typically this will be zero.
|
Typically this will be zero.
|
||||||
|
|
||||||
|
int sapp_gl_get_major_version(void)
|
||||||
|
int sapp_gl_get_minor_version(void)
|
||||||
|
Returns the major and minor version of the GL context
|
||||||
|
(only for SOKOL_GLCORE, all other backends return zero here, including SOKOL_GLES3)
|
||||||
|
|
||||||
const void* sapp_android_get_native_activity(void);
|
const void* sapp_android_get_native_activity(void);
|
||||||
On Android, get the native activity ANativeActivity pointer, otherwise
|
On Android, get the native activity ANativeActivity pointer, otherwise
|
||||||
a null pointer.
|
a null pointer.
|
||||||
|
@ -348,7 +355,7 @@
|
||||||
sapp_consume_event() from inside the event handler (NOTE that
|
sapp_consume_event() from inside the event handler (NOTE that
|
||||||
this behaviour is currently only implemented for some HTML5
|
this behaviour is currently only implemented for some HTML5
|
||||||
events, support for other platforms and event types will
|
events, support for other platforms and event types will
|
||||||
be added as needed, please open a github ticket and/or provide
|
be added as needed, please open a GitHub ticket and/or provide
|
||||||
a PR if needed).
|
a PR if needed).
|
||||||
|
|
||||||
NOTE: Do *not* call any 3D API rendering functions in the event
|
NOTE: Do *not* call any 3D API rendering functions in the event
|
||||||
|
@ -1892,6 +1899,10 @@ SOKOL_APP_API_DECL const void* sapp_wgpu_get_depth_stencil_view(void);
|
||||||
|
|
||||||
/* GL: get framebuffer object */
|
/* GL: get framebuffer object */
|
||||||
SOKOL_APP_API_DECL uint32_t sapp_gl_get_framebuffer(void);
|
SOKOL_APP_API_DECL uint32_t sapp_gl_get_framebuffer(void);
|
||||||
|
/* GL: get major version (only valid for desktop GL) */
|
||||||
|
SOKOL_APP_API_DECL int sapp_gl_get_major_version(void);
|
||||||
|
/* GL: get minor version (only valid for desktop GL) */
|
||||||
|
SOKOL_APP_API_DECL int sapp_gl_get_minor_version(void);
|
||||||
|
|
||||||
/* Android: get native activity handle */
|
/* Android: get native activity handle */
|
||||||
SOKOL_APP_API_DECL const void* sapp_android_get_native_activity(void);
|
SOKOL_APP_API_DECL const void* sapp_android_get_native_activity(void);
|
||||||
|
@ -1959,8 +1970,8 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); }
|
||||||
#if defined(TARGET_OS_IPHONE) && !TARGET_OS_IPHONE
|
#if defined(TARGET_OS_IPHONE) && !TARGET_OS_IPHONE
|
||||||
/* MacOS */
|
/* MacOS */
|
||||||
#define _SAPP_MACOS (1)
|
#define _SAPP_MACOS (1)
|
||||||
#if !defined(SOKOL_METAL) && !defined(SOKOL_GLCORE33)
|
#if !defined(SOKOL_METAL) && !defined(SOKOL_GLCORE)
|
||||||
#error("sokol_app.h: unknown 3D API selected for MacOS, must be SOKOL_METAL or SOKOL_GLCORE33")
|
#error("sokol_app.h: unknown 3D API selected for MacOS, must be SOKOL_METAL or SOKOL_GLCORE")
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
/* iOS or iOS Simulator */
|
/* iOS or iOS Simulator */
|
||||||
|
@ -1978,8 +1989,8 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); }
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
/* Windows (D3D11 or GL) */
|
/* Windows (D3D11 or GL) */
|
||||||
#define _SAPP_WIN32 (1)
|
#define _SAPP_WIN32 (1)
|
||||||
#if !defined(SOKOL_D3D11) && !defined(SOKOL_GLCORE33)
|
#if !defined(SOKOL_D3D11) && !defined(SOKOL_GLCORE) && !defined(SOKOL_NOAPI)
|
||||||
#error("sokol_app.h: unknown 3D API selected for Win32, must be SOKOL_D3D11 or SOKOL_GLCORE33")
|
#error("sokol_app.h: unknown 3D API selected for Win32, must be SOKOL_D3D11, SOKOL_GLCORE or SOKOL_NOAPI")
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__ANDROID__)
|
#elif defined(__ANDROID__)
|
||||||
/* Android */
|
/* Android */
|
||||||
|
@ -1993,7 +2004,7 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); }
|
||||||
#elif defined(__linux__) || defined(__unix__)
|
#elif defined(__linux__) || defined(__unix__)
|
||||||
/* Linux */
|
/* Linux */
|
||||||
#define _SAPP_LINUX (1)
|
#define _SAPP_LINUX (1)
|
||||||
#if defined(SOKOL_GLCORE33)
|
#if defined(SOKOL_GLCORE)
|
||||||
#if !defined(SOKOL_FORCE_EGL)
|
#if !defined(SOKOL_FORCE_EGL)
|
||||||
#define _SAPP_GLX (1)
|
#define _SAPP_GLX (1)
|
||||||
#endif
|
#endif
|
||||||
|
@ -2003,13 +2014,13 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); }
|
||||||
#include <GLES3/gl3.h>
|
#include <GLES3/gl3.h>
|
||||||
#include <GLES3/gl3ext.h>
|
#include <GLES3/gl3ext.h>
|
||||||
#else
|
#else
|
||||||
#error("sokol_app.h: unknown 3D API selected for Linux, must be SOKOL_GLCORE33, SOKOL_GLES3")
|
#error("sokol_app.h: unknown 3D API selected for Linux, must be SOKOL_GLCORE, SOKOL_GLES3")
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#error "sokol_app.h: Unknown platform"
|
#error "sokol_app.h: Unknown platform"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SOKOL_GLCORE33) || defined(SOKOL_GLES3)
|
#if defined(SOKOL_GLCORE) || defined(SOKOL_GLES3)
|
||||||
#define _SAPP_ANY_GL (1)
|
#define _SAPP_ANY_GL (1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2399,11 +2410,11 @@ _SOKOL_PRIVATE double _sapp_timing_get_avg(_sapp_timing_t* t) {
|
||||||
#if defined(SOKOL_METAL)
|
#if defined(SOKOL_METAL)
|
||||||
@interface _sapp_macos_view : MTKView
|
@interface _sapp_macos_view : MTKView
|
||||||
@end
|
@end
|
||||||
#elif defined(SOKOL_GLCORE33)
|
#elif defined(SOKOL_GLCORE)
|
||||||
@interface _sapp_macos_view : NSOpenGLView
|
@interface _sapp_macos_view : NSOpenGLView
|
||||||
- (void)timerFired:(id)sender;
|
- (void)timerFired:(id)sender;
|
||||||
@end
|
@end
|
||||||
#endif // SOKOL_GLCORE33
|
#endif // SOKOL_GLCORE
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t flags_changed_store;
|
uint32_t flags_changed_store;
|
||||||
|
@ -2545,7 +2556,7 @@ typedef struct {
|
||||||
uint8_t raw_input_data[256];
|
uint8_t raw_input_data[256];
|
||||||
} _sapp_win32_t;
|
} _sapp_win32_t;
|
||||||
|
|
||||||
#if defined(SOKOL_GLCORE33)
|
#if defined(SOKOL_GLCORE)
|
||||||
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
|
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
|
||||||
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
||||||
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||||
|
@ -2605,7 +2616,7 @@ typedef struct {
|
||||||
HWND msg_hwnd;
|
HWND msg_hwnd;
|
||||||
HDC msg_dc;
|
HDC msg_dc;
|
||||||
} _sapp_wgl_t;
|
} _sapp_wgl_t;
|
||||||
#endif // SOKOL_GLCORE33
|
#endif // SOKOL_GLCORE
|
||||||
|
|
||||||
#endif // _SAPP_WIN32
|
#endif // _SAPP_WIN32
|
||||||
|
|
||||||
|
@ -2876,7 +2887,7 @@ typedef struct {
|
||||||
_sapp_win32_t win32;
|
_sapp_win32_t win32;
|
||||||
#if defined(SOKOL_D3D11)
|
#if defined(SOKOL_D3D11)
|
||||||
_sapp_d3d11_t d3d11;
|
_sapp_d3d11_t d3d11;
|
||||||
#elif defined(SOKOL_GLCORE33)
|
#elif defined(SOKOL_GLCORE)
|
||||||
_sapp_wgl_t wgl;
|
_sapp_wgl_t wgl;
|
||||||
#endif
|
#endif
|
||||||
#elif defined(_SAPP_ANDROID)
|
#elif defined(_SAPP_ANDROID)
|
||||||
|
@ -3085,8 +3096,13 @@ _SOKOL_PRIVATE sapp_desc _sapp_desc_defaults(const sapp_desc* desc) {
|
||||||
// (or expressed differently: zero is a valid value for gl_minor_version
|
// (or expressed differently: zero is a valid value for gl_minor_version
|
||||||
// and can't be used to indicate 'default')
|
// and can't be used to indicate 'default')
|
||||||
if (0 == res.gl_major_version) {
|
if (0 == res.gl_major_version) {
|
||||||
res.gl_major_version = 3;
|
#if defined(_SAPP_APPLE)
|
||||||
res.gl_minor_version = 2;
|
res.gl_major_version = 4;
|
||||||
|
res.gl_minor_version = 1;
|
||||||
|
#else
|
||||||
|
res.gl_major_version = 4;
|
||||||
|
res.gl_minor_version = 3;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
res.html5_canvas_name = _sapp_def(res.html5_canvas_name, "canvas");
|
res.html5_canvas_name = _sapp_def(res.html5_canvas_name, "canvas");
|
||||||
res.clipboard_size = _sapp_def(res.clipboard_size, 8192);
|
res.clipboard_size = _sapp_def(res.clipboard_size, 8192);
|
||||||
|
@ -3650,7 +3666,7 @@ _SOKOL_PRIVATE void _sapp_macos_update_dimensions(void) {
|
||||||
const int cur_fb_height = (int)roundf(fb_size.height);
|
const int cur_fb_height = (int)roundf(fb_size.height);
|
||||||
const bool dim_changed = (_sapp.framebuffer_width != cur_fb_width) ||
|
const bool dim_changed = (_sapp.framebuffer_width != cur_fb_width) ||
|
||||||
(_sapp.framebuffer_height != cur_fb_height);
|
(_sapp.framebuffer_height != cur_fb_height);
|
||||||
#elif defined(SOKOL_GLCORE33)
|
#elif defined(SOKOL_GLCORE)
|
||||||
const int cur_fb_width = (int)roundf(bounds.size.width * _sapp.dpi_scale);
|
const int cur_fb_width = (int)roundf(bounds.size.width * _sapp.dpi_scale);
|
||||||
const int cur_fb_height = (int)roundf(bounds.size.height * _sapp.dpi_scale);
|
const int cur_fb_height = (int)roundf(bounds.size.height * _sapp.dpi_scale);
|
||||||
const bool dim_changed = (_sapp.framebuffer_width != cur_fb_width) ||
|
const bool dim_changed = (_sapp.framebuffer_width != cur_fb_width) ||
|
||||||
|
@ -3892,7 +3908,7 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) {
|
||||||
_sapp.macos.window.contentView = _sapp.macos.view;
|
_sapp.macos.window.contentView = _sapp.macos.view;
|
||||||
[_sapp.macos.window makeFirstResponder:_sapp.macos.view];
|
[_sapp.macos.window makeFirstResponder:_sapp.macos.view];
|
||||||
_sapp.macos.view.layer.magnificationFilter = kCAFilterNearest;
|
_sapp.macos.view.layer.magnificationFilter = kCAFilterNearest;
|
||||||
#elif defined(SOKOL_GLCORE33)
|
#elif defined(SOKOL_GLCORE)
|
||||||
NSOpenGLPixelFormatAttribute attrs[32];
|
NSOpenGLPixelFormatAttribute attrs[32];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
attrs[i++] = NSOpenGLPFAAccelerated;
|
attrs[i++] = NSOpenGLPFAAccelerated;
|
||||||
|
@ -4124,7 +4140,7 @@ _SOKOL_PRIVATE void _sapp_macos_frame(void) {
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation _sapp_macos_view
|
@implementation _sapp_macos_view
|
||||||
#if defined(SOKOL_GLCORE33)
|
#if defined(SOKOL_GLCORE)
|
||||||
- (void)timerFired:(id)sender {
|
- (void)timerFired:(id)sender {
|
||||||
_SOKOL_UNUSED(sender);
|
_SOKOL_UNUSED(sender);
|
||||||
[self setNeedsDisplay:YES];
|
[self setNeedsDisplay:YES];
|
||||||
|
@ -4224,7 +4240,7 @@ _SOKOL_PRIVATE void _sapp_macos_poll_input_events(void) {
|
||||||
|
|
||||||
// helper function to make GL context active
|
// helper function to make GL context active
|
||||||
static void _sapp_gl_make_current(void) {
|
static void _sapp_gl_make_current(void) {
|
||||||
#if defined(SOKOL_GLCORE33)
|
#if defined(SOKOL_GLCORE)
|
||||||
[[_sapp.macos.view openGLContext] makeCurrentContext];
|
[[_sapp.macos.view openGLContext] makeCurrentContext];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -5945,7 +5961,7 @@ int main(int argc, char* argv[]) {
|
||||||
// ██████ ███████ ██ ██ ███████ ███████ ██ ███████ ██ ██ ███████
|
// ██████ ███████ ██ ██ ███████ ███████ ██ ███████ ██ ██ ███████
|
||||||
//
|
//
|
||||||
// >>gl helpers
|
// >>gl helpers
|
||||||
#if defined(SOKOL_GLCORE33)
|
#if defined(SOKOL_GLCORE)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int red_bits;
|
int red_bits;
|
||||||
int green_bits;
|
int green_bits;
|
||||||
|
@ -6596,7 +6612,7 @@ _SOKOL_PRIVATE void _sapp_d3d11_present(bool do_not_wait) {
|
||||||
|
|
||||||
#endif /* SOKOL_D3D11 */
|
#endif /* SOKOL_D3D11 */
|
||||||
|
|
||||||
#if defined(SOKOL_GLCORE33)
|
#if defined(SOKOL_GLCORE)
|
||||||
_SOKOL_PRIVATE void _sapp_wgl_init(void) {
|
_SOKOL_PRIVATE void _sapp_wgl_init(void) {
|
||||||
_sapp.wgl.opengl32 = LoadLibraryA("opengl32.dll");
|
_sapp.wgl.opengl32 = LoadLibraryA("opengl32.dll");
|
||||||
if (!_sapp.wgl.opengl32) {
|
if (!_sapp.wgl.opengl32) {
|
||||||
|
@ -6894,7 +6910,7 @@ _SOKOL_PRIVATE void _sapp_wgl_swap_buffers(void) {
|
||||||
/* FIXME: DwmIsCompositionEnabled? (see GLFW) */
|
/* FIXME: DwmIsCompositionEnabled? (see GLFW) */
|
||||||
SwapBuffers(_sapp.win32.dc);
|
SwapBuffers(_sapp.win32.dc);
|
||||||
}
|
}
|
||||||
#endif /* SOKOL_GLCORE33 */
|
#endif /* SOKOL_GLCORE */
|
||||||
|
|
||||||
_SOKOL_PRIVATE bool _sapp_win32_wide_to_utf8(const wchar_t* src, char* dst, int dst_num_bytes) {
|
_SOKOL_PRIVATE bool _sapp_win32_wide_to_utf8(const wchar_t* src, char* dst, int dst_num_bytes) {
|
||||||
SOKOL_ASSERT(src && dst && (dst_num_bytes > 1));
|
SOKOL_ASSERT(src && dst && (dst_num_bytes > 1));
|
||||||
|
@ -7311,7 +7327,10 @@ _SOKOL_PRIVATE void _sapp_win32_timing_measure(void) {
|
||||||
// fallback if swap model isn't "flip-discard" or GetFrameStatistics failed for another reason
|
// fallback if swap model isn't "flip-discard" or GetFrameStatistics failed for another reason
|
||||||
_sapp_timing_measure(&_sapp.timing);
|
_sapp_timing_measure(&_sapp.timing);
|
||||||
#endif
|
#endif
|
||||||
#if defined(SOKOL_GLCORE33)
|
#if defined(SOKOL_GLCORE)
|
||||||
|
_sapp_timing_measure(&_sapp.timing);
|
||||||
|
#endif
|
||||||
|
#if defined(SOKOL_NOAPI)
|
||||||
_sapp_timing_measure(&_sapp.timing);
|
_sapp_timing_measure(&_sapp.timing);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -7513,7 +7532,7 @@ _SOKOL_PRIVATE LRESULT CALLBACK _sapp_win32_wndproc(HWND hWnd, UINT uMsg, WPARAM
|
||||||
// present with DXGI_PRESENT_DO_NOT_WAIT
|
// present with DXGI_PRESENT_DO_NOT_WAIT
|
||||||
_sapp_d3d11_present(true);
|
_sapp_d3d11_present(true);
|
||||||
#endif
|
#endif
|
||||||
#if defined(SOKOL_GLCORE33)
|
#if defined(SOKOL_GLCORE)
|
||||||
_sapp_wgl_swap_buffers();
|
_sapp_wgl_swap_buffers();
|
||||||
#endif
|
#endif
|
||||||
/* NOTE: resizing the swap-chain during resize leads to a substantial
|
/* NOTE: resizing the swap-chain during resize leads to a substantial
|
||||||
|
@ -7926,7 +7945,7 @@ _SOKOL_PRIVATE void _sapp_win32_run(const sapp_desc* desc) {
|
||||||
_sapp_d3d11_create_device_and_swapchain();
|
_sapp_d3d11_create_device_and_swapchain();
|
||||||
_sapp_d3d11_create_default_render_target();
|
_sapp_d3d11_create_default_render_target();
|
||||||
#endif
|
#endif
|
||||||
#if defined(SOKOL_GLCORE33)
|
#if defined(SOKOL_GLCORE)
|
||||||
_sapp_wgl_init();
|
_sapp_wgl_init();
|
||||||
_sapp_wgl_load_extensions();
|
_sapp_wgl_load_extensions();
|
||||||
_sapp_wgl_create_context();
|
_sapp_wgl_create_context();
|
||||||
|
@ -7954,7 +7973,7 @@ _SOKOL_PRIVATE void _sapp_win32_run(const sapp_desc* desc) {
|
||||||
Sleep((DWORD)(16 * _sapp.swap_interval));
|
Sleep((DWORD)(16 * _sapp.swap_interval));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(SOKOL_GLCORE33)
|
#if defined(SOKOL_GLCORE)
|
||||||
_sapp_wgl_swap_buffers();
|
_sapp_wgl_swap_buffers();
|
||||||
#endif
|
#endif
|
||||||
/* check for window resized, this cannot happen in WM_SIZE as it explodes memory usage */
|
/* check for window resized, this cannot happen in WM_SIZE as it explodes memory usage */
|
||||||
|
@ -10947,7 +10966,7 @@ _SOKOL_PRIVATE void _sapp_x11_process_event(XEvent* event) {
|
||||||
#if !defined(_SAPP_GLX)
|
#if !defined(_SAPP_GLX)
|
||||||
|
|
||||||
_SOKOL_PRIVATE void _sapp_egl_init(void) {
|
_SOKOL_PRIVATE void _sapp_egl_init(void) {
|
||||||
#if defined(SOKOL_GLCORE33)
|
#if defined(SOKOL_GLCORE)
|
||||||
if (!eglBindAPI(EGL_OPENGL_API)) {
|
if (!eglBindAPI(EGL_OPENGL_API)) {
|
||||||
_SAPP_PANIC(LINUX_EGL_BIND_OPENGL_API_FAILED);
|
_SAPP_PANIC(LINUX_EGL_BIND_OPENGL_API_FAILED);
|
||||||
}
|
}
|
||||||
|
@ -10971,7 +10990,7 @@ _SOKOL_PRIVATE void _sapp_egl_init(void) {
|
||||||
EGLint alpha_size = _sapp.desc.alpha ? 8 : 0;
|
EGLint alpha_size = _sapp.desc.alpha ? 8 : 0;
|
||||||
const EGLint config_attrs[] = {
|
const EGLint config_attrs[] = {
|
||||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||||
#if defined(SOKOL_GLCORE33)
|
#if defined(SOKOL_GLCORE)
|
||||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
||||||
#elif defined(SOKOL_GLES3)
|
#elif defined(SOKOL_GLES3)
|
||||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT,
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT,
|
||||||
|
@ -11034,7 +11053,7 @@ _SOKOL_PRIVATE void _sapp_egl_init(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLint ctx_attrs[] = {
|
EGLint ctx_attrs[] = {
|
||||||
#if defined(SOKOL_GLCORE33)
|
#if defined(SOKOL_GLCORE)
|
||||||
EGL_CONTEXT_MAJOR_VERSION, _sapp.desc.gl_major_version,
|
EGL_CONTEXT_MAJOR_VERSION, _sapp.desc.gl_major_version,
|
||||||
EGL_CONTEXT_MINOR_VERSION, _sapp.desc.gl_minor_version,
|
EGL_CONTEXT_MINOR_VERSION, _sapp.desc.gl_minor_version,
|
||||||
EGL_CONTEXT_OPENGL_PROFILE_MASK, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
|
EGL_CONTEXT_OPENGL_PROFILE_MASK, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
|
||||||
|
@ -11753,6 +11772,24 @@ SOKOL_API_IMPL uint32_t sapp_gl_get_framebuffer(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SOKOL_API_IMPL int sapp_gl_get_major_version(void) {
|
||||||
|
SOKOL_ASSERT(_sapp.valid);
|
||||||
|
#if defined(SOKOL_GLCORE)
|
||||||
|
return _sapp.desc.gl_major_version;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
SOKOL_API_IMPL int sapp_gl_get_minor_version(void) {
|
||||||
|
SOKOL_ASSERT(_sapp.valid);
|
||||||
|
#if defined(SOKOL_GLCORE)
|
||||||
|
return _sapp.desc.gl_minor_version;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
SOKOL_API_IMPL const void* sapp_android_get_native_activity(void) {
|
SOKOL_API_IMPL const void* sapp_android_get_native_activity(void) {
|
||||||
// NOTE: _sapp.valid is not asserted here because sapp_android_get_native_activity()
|
// NOTE: _sapp.valid is not asserted here because sapp_android_get_native_activity()
|
||||||
// needs to be callable from within sokol_main() (see: https://github.com/floooh/sokol/issues/708)
|
// needs to be callable from within sokol_main() (see: https://github.com/floooh/sokol/issues/708)
|
||||||
|
|
813
source/engine/thirdparty/sokol/sokol_gfx.h
vendored
813
source/engine/thirdparty/sokol/sokol_gfx.h
vendored
File diff suppressed because it is too large
Load diff
2
source/engine/thirdparty/sokol/sokol_glue.h
vendored
2
source/engine/thirdparty/sokol/sokol_glue.h
vendored
|
@ -43,7 +43,7 @@
|
||||||
functions. Use this in the sg_setup() call like this:
|
functions. Use this in the sg_setup() call like this:
|
||||||
|
|
||||||
sg_setup(&(sg_desc){
|
sg_setup(&(sg_desc){
|
||||||
.environment = sglue_enviornment(),
|
.environment = sglue_environment(),
|
||||||
...
|
...
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue