Skip to content

Commit 7d6dab1

Browse files
committed
Merge branch 'master' of https://github.com/danielchasehooper/sokol into danielchasehooper-master
2 parents 7277c7f + 2ead539 commit 7d6dab1

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

bindgen/gen_rust.py

+2
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,8 @@ def funcptr_result_c(field_type):
355355
res_type = field_type[: field_type.index("(*)")].strip()
356356
if res_type == "void":
357357
return ""
358+
elif is_prim_type(res_type):
359+
return as_rust_prim_type(res_type)
358360
elif util.is_const_void_ptr(res_type):
359361
return " -> *const core::ffi::c_void"
360362
elif util.is_void_ptr(res_type):

bindgen/gen_zig.py

+2
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ def funcptr_result_c(field_type):
271271
res_type = field_type[:field_type.index('(*)')].strip()
272272
if res_type == 'void':
273273
return 'void'
274+
elif is_prim_type(res_type):
275+
return as_zig_prim_type(res_type)
274276
elif util.is_const_void_ptr(res_type):
275277
return '?*const anyopaque'
276278
elif util.is_void_ptr(res_type):

sokol_gfx.h

+15
Original file line numberDiff line numberDiff line change
@@ -3245,13 +3245,20 @@ typedef struct sg_wgpu_context_desc {
32453245
void* user_data;
32463246
} sg_wgpu_context_desc;
32473247

3248+
typedef struct sg_gl_context_desc {
3249+
uint32_t (*default_framebuffer_cb)(void);
3250+
uint32_t (*default_framebuffer_userdata_cb)(void*);
3251+
void* user_data;
3252+
} sg_gl_context_desc;
3253+
32483254
typedef struct sg_context_desc {
32493255
sg_pixel_format color_format;
32503256
sg_pixel_format depth_format;
32513257
int sample_count;
32523258
sg_metal_context_desc metal;
32533259
sg_d3d11_context_desc d3d11;
32543260
sg_wgpu_context_desc wgpu;
3261+
sg_gl_context_desc gl;
32553262
} sg_context_desc;
32563263

32573264
/*
@@ -7036,6 +7043,8 @@ _SOKOL_PRIVATE void _sg_gl_reset_state_cache(void) {
70367043

70377044
_SOKOL_PRIVATE void _sg_gl_setup_backend(const sg_desc* desc) {
70387045
_SOKOL_UNUSED(desc);
7046+
SOKOL_ASSERT(desc->context.gl.default_framebuffer_cb == 0 || desc->context.gl.default_framebuffer_userdata_cb == 0);
7047+
70397048
// assumes that _sg.gl is already zero-initialized
70407049
_sg.gl.valid = true;
70417050

@@ -7724,6 +7733,12 @@ _SOKOL_PRIVATE void _sg_gl_begin_pass(_sg_pass_t* pass, const sg_pass_action* ac
77247733
#if defined(SOKOL_GLCORE33)
77257734
glDisable(GL_FRAMEBUFFER_SRGB);
77267735
#endif
7736+
if (_sg.desc.context.gl.default_framebuffer_userdata_cb) {
7737+
_sg.gl.cur_context->default_framebuffer = _sg.desc.context.gl.default_framebuffer_userdata_cb(_sg.desc.context.gl.user_data);
7738+
} else if (_sg.desc.context.gl.default_framebuffer_cb) {
7739+
_sg.gl.cur_context->default_framebuffer = _sg.desc.context.gl.default_framebuffer_cb();
7740+
}
7741+
77277742
glBindFramebuffer(GL_FRAMEBUFFER, _sg.gl.cur_context->default_framebuffer);
77287743
}
77297744
glViewport(0, 0, w, h);

0 commit comments

Comments
 (0)