1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 use std::os::raw::c_void;
10 pub extern "C" fn wr_swgl_create_context() -> *mut c_void {
11 swgl::Context::create().into()
15 pub extern "C" fn wr_swgl_reference_context(ctx: *mut c_void) {
16 swgl::Context::from(ctx).reference();
20 pub extern "C" fn wr_swgl_destroy_context(ctx: *mut c_void) {
21 swgl::Context::from(ctx).destroy();
25 pub extern "C" fn wr_swgl_make_current(ctx: *mut c_void) {
26 swgl::Context::from(ctx).make_current();
30 pub extern "C" fn wr_swgl_init_default_framebuffer(
39 swgl::Context::from(ctx).init_default_framebuffer(x, y, width, height, stride, buf);
43 pub extern "C" fn wr_swgl_resolve_framebuffer(ctx: *mut c_void, fbo: u32) {
44 swgl::Context::from(ctx).resolve_framebuffer(fbo);
48 pub extern "C" fn wr_swgl_gen_texture(ctx: *mut c_void) -> u32 {
49 swgl::Context::from(ctx).gen_textures(1)[0]
53 pub extern "C" fn wr_swgl_delete_texture(ctx: *mut c_void, tex: u32) {
54 swgl::Context::from(ctx).delete_textures(&[tex]);
58 pub extern "C" fn wr_swgl_set_texture_parameter(ctx: *mut c_void, tex: u32, pname: u32, param: i32) {
59 swgl::Context::from(ctx).set_texture_parameter(tex, pname, param);
63 pub extern "C" fn wr_swgl_set_texture_buffer(
74 swgl::Context::from(ctx).set_texture_buffer(
87 #[allow(clippy::many_single_char_names)]
88 pub extern "C" fn wr_swgl_clear_color_rect(
100 swgl::Context::from(ctx).clear_color_rect(fbo, x, y, width, height, r, g, b, a);