mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +03:00
sokol, gg, examples: update to match uptream at 058a4c5 (#20953)
This commit is contained in:
parent
60b4fb31a1
commit
790ea2f1bd
20 changed files with 3092 additions and 2362 deletions
|
@ -387,7 +387,8 @@ fn draw_cube_glsl(app App) {
|
|||
}
|
||||
mut pass_action := gfx.PassAction{}
|
||||
pass_action.colors[0] = color_action
|
||||
gfx.begin_default_pass(&pass_action, ws.width, ws.height)
|
||||
pass := sapp.create_default_pass(pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
{
|
||||
rot := [f32(app.mouse_y), f32(app.mouse_x)]
|
||||
// ratio := f32(ws.width)/ws.height
|
||||
|
|
|
@ -314,8 +314,6 @@ fn draw_cube_glsl(app App) {
|
|||
}
|
||||
|
||||
fn frame(mut app App) {
|
||||
ws := gg.window_size_real_pixels()
|
||||
|
||||
// clear
|
||||
mut color_action := gfx.ColorAttachmentAction{
|
||||
load_action: .clear
|
||||
|
@ -329,7 +327,8 @@ fn frame(mut app App) {
|
|||
|
||||
mut pass_action := gfx.PassAction{}
|
||||
pass_action.colors[0] = color_action
|
||||
gfx.begin_default_pass(&pass_action, ws.width, ws.height)
|
||||
pass := sapp.create_default_pass(pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
|
||||
// glsl cube
|
||||
draw_cube_glsl(app)
|
||||
|
|
|
@ -502,8 +502,6 @@ fn draw_end_glsl(app App) {
|
|||
}
|
||||
|
||||
fn frame(mut app App) {
|
||||
ws := gg.window_size_real_pixels()
|
||||
|
||||
// clear
|
||||
mut color_action := gfx.ColorAttachmentAction{
|
||||
load_action: .clear
|
||||
|
@ -516,7 +514,8 @@ fn frame(mut app App) {
|
|||
}
|
||||
mut pass_action := gfx.PassAction{}
|
||||
pass_action.colors[0] = color_action
|
||||
gfx.begin_default_pass(&pass_action, ws.width, ws.height)
|
||||
pass := sapp.create_default_pass(pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
|
||||
/*
|
||||
// glsl cube
|
||||
|
|
|
@ -388,8 +388,6 @@ fn draw_end_glsl(app App) {
|
|||
}
|
||||
|
||||
fn frame(mut app App) {
|
||||
ws := gg.window_size_real_pixels()
|
||||
|
||||
// clear
|
||||
mut color_action := gfx.ColorAttachmentAction{
|
||||
load_action: .clear
|
||||
|
@ -402,7 +400,8 @@ fn frame(mut app App) {
|
|||
}
|
||||
mut pass_action := gfx.PassAction{}
|
||||
pass_action.colors[0] = color_action
|
||||
gfx.begin_default_pass(&pass_action, ws.width, ws.height)
|
||||
pass := gg.create_default_pass(pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
|
||||
draw_start_glsl(app)
|
||||
draw_cube_glsl_i(mut app)
|
||||
|
|
|
@ -144,8 +144,6 @@ fn draw_model(app App, model_pos m4.Vec4) u32 {
|
|||
}
|
||||
|
||||
fn frame(mut app App) {
|
||||
ws := gg.window_size_real_pixels()
|
||||
|
||||
// clear
|
||||
mut color_action := gfx.ColorAttachmentAction{
|
||||
load_action: .clear
|
||||
|
@ -159,7 +157,8 @@ fn frame(mut app App) {
|
|||
|
||||
mut pass_action := gfx.PassAction{}
|
||||
pass_action.colors[0] = color_action
|
||||
gfx.begin_default_pass(&pass_action, ws.width, ws.height)
|
||||
pass := sapp.create_default_pass(pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
|
||||
// render the data
|
||||
draw_start_glsl(app)
|
||||
|
|
|
@ -11,7 +11,7 @@ const used_import = sokol.used_import
|
|||
|
||||
fn main() {
|
||||
state := &AppState{
|
||||
pass_action: gfx.create_clear_pass(0.1, 0.1, 0.1, 1.0)
|
||||
pass_action: gfx.create_clear_pass_action(0.1, 0.1, 0.1, 1.0)
|
||||
}
|
||||
title := 'Sokol Drawing Template'
|
||||
desc := sapp.Desc{
|
||||
|
@ -36,7 +36,8 @@ fn init(user_data voidptr) {
|
|||
fn frame(state &AppState) {
|
||||
// println('frame')
|
||||
draw()
|
||||
gfx.begin_default_pass(&state.pass_action, sapp.width(), sapp.height())
|
||||
pass := sapp.create_default_pass(state.pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
sgl.draw()
|
||||
gfx.end_pass()
|
||||
gfx.commit()
|
||||
|
|
|
@ -14,19 +14,8 @@ mut:
|
|||
}
|
||||
|
||||
fn main() {
|
||||
mut color_action := gfx.ColorAttachmentAction{
|
||||
load_action: .clear
|
||||
clear_value: gfx.Color{
|
||||
r: 0.3
|
||||
g: 0.3
|
||||
b: 0.32
|
||||
a: 1.0
|
||||
}
|
||||
}
|
||||
mut pass_action := gfx.PassAction{}
|
||||
pass_action.colors[0] = color_action
|
||||
state := &AppState{
|
||||
pass_action: pass_action
|
||||
pass_action: gfx.create_clear_pass_action(0.3, 0.3, 0.32, 1.0)
|
||||
font_context: unsafe { nil } // &fontstash.Context(0)
|
||||
}
|
||||
title := 'V Metal/GL Text Rendering'
|
||||
|
@ -57,7 +46,8 @@ fn init(mut state AppState) {
|
|||
|
||||
fn frame(mut state AppState) {
|
||||
state.render_font()
|
||||
gfx.begin_default_pass(&state.pass_action, sapp.width(), sapp.height())
|
||||
pass := sapp.create_default_pass(state.pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
sgl.draw()
|
||||
gfx.end_pass()
|
||||
gfx.commit()
|
||||
|
|
|
@ -107,7 +107,8 @@ fn init(mut state AppState) {
|
|||
|
||||
fn frame(mut state AppState) {
|
||||
state.render_font()
|
||||
gfx.begin_default_pass(&state.pass_action, sapp.width(), sapp.height())
|
||||
pass := sapp.create_default_pass(state.pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
sgl.draw()
|
||||
gfx.end_pass()
|
||||
gfx.commit()
|
||||
|
|
|
@ -15,7 +15,7 @@ fn main() {
|
|||
mut app := &App{
|
||||
width: 800
|
||||
height: 400
|
||||
pass_action: gfx.create_clear_pass(0.1, 0.1, 0.1, 1.0)
|
||||
pass_action: gfx.create_clear_pass_action(0.1, 0.1, 0.1, 1.0)
|
||||
}
|
||||
app.init()
|
||||
app.run()
|
||||
|
@ -105,7 +105,8 @@ fn frame(mut app App) {
|
|||
dt := f64(t - app.last) / 1000.0
|
||||
app.ps.update(dt)
|
||||
draw(app)
|
||||
gfx.begin_default_pass(&app.pass_action, app.width, app.height)
|
||||
pass := sapp.create_default_pass(app.pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
sgl.default_pipeline()
|
||||
sgl.draw()
|
||||
gfx.end_pass()
|
||||
|
|
|
@ -36,7 +36,7 @@ fn main() {
|
|||
mut app := &App{
|
||||
width: 800
|
||||
height: 400
|
||||
pass_action: gfx.create_clear_pass(0.0, 0.0, 0.0, 1.0) // This will create a black color as a default pass (window background color)
|
||||
pass_action: gfx.create_clear_pass_action(0.0, 0.0, 0.0, 1.0) // This will create a black color as a default pass (window background color)
|
||||
}
|
||||
app.run()
|
||||
}
|
||||
|
@ -143,7 +143,8 @@ fn cleanup(user_data voidptr) {
|
|||
fn frame(user_data voidptr) {
|
||||
mut app := unsafe { &App(user_data) }
|
||||
|
||||
gfx.begin_default_pass(&app.pass_action, sapp.width(), sapp.height())
|
||||
pass := sapp.create_default_pass(state.pass_action)
|
||||
gfx.begin_pass(&pass)
|
||||
|
||||
gfx.apply_pipeline(app.shader_pipeline)
|
||||
gfx.apply_bindings(&app.bind)
|
||||
|
|
566
thirdparty/sokol/sokol_app.h
vendored
566
thirdparty/sokol/sokol_app.h
vendored
File diff suppressed because it is too large
Load diff
3896
thirdparty/sokol/sokol_gfx.h
vendored
3896
thirdparty/sokol/sokol_gfx.h
vendored
File diff suppressed because it is too large
Load diff
2
thirdparty/sokol/util/sokol_gl.h
vendored
2
thirdparty/sokol/util/sokol_gl.h
vendored
|
@ -833,7 +833,7 @@ SOKOL_GL_API_DECL sgl_context sgl_get_context(void);
|
|||
SOKOL_GL_API_DECL sgl_context sgl_default_context(void);
|
||||
|
||||
/* draw recorded commands (call inside a sokol-gfx render pass) */
|
||||
SOKOL_GL_API_DECL void sgl_draw();
|
||||
SOKOL_GL_API_DECL void sgl_draw(void);
|
||||
SOKOL_GL_API_DECL void sgl_context_draw(sgl_context ctx);
|
||||
SOKOL_GL_API_DECL void sgl_draw_layer(int layer_id);
|
||||
SOKOL_GL_API_DECL void sgl_context_draw_layer(sgl_context ctx, int layer_id);
|
||||
|
|
|
@ -509,8 +509,8 @@ pub fn (ctx &Context) quit() {
|
|||
|
||||
// set_bg_color sets the color of the window background to `c`.
|
||||
pub fn (mut ctx Context) set_bg_color(c gx.Color) {
|
||||
ctx.clear_pass = gfx.create_clear_pass(f32(c.r) / 255.0, f32(c.g) / 255.0, f32(c.b) / 255.0,
|
||||
f32(c.a) / 255.0)
|
||||
ctx.clear_pass = gfx.create_clear_pass_action(f32(c.r) / 255.0, f32(c.g) / 255.0,
|
||||
f32(c.b) / 255.0, f32(c.a) / 255.0)
|
||||
}
|
||||
|
||||
// Resize the context's Window
|
||||
|
@ -566,6 +566,10 @@ const dontcare_pass = gfx.PassAction{
|
|||
]!
|
||||
}
|
||||
|
||||
pub fn create_default_pass(action gfx.PassAction) gfx.Pass {
|
||||
return sapp.create_default_pass(action)
|
||||
}
|
||||
|
||||
// end finishes all the drawing for the context ctx.
|
||||
// All accumulated draw calls before ctx.end(), will be done in a separate Sokol pass.
|
||||
//
|
||||
|
@ -592,14 +596,15 @@ pub fn (ctx &Context) end(options EndOptions) {
|
|||
ctx.show_fps()
|
||||
}
|
||||
}
|
||||
match options.how {
|
||||
pass := match options.how {
|
||||
.clear {
|
||||
gfx.begin_default_pass(ctx.clear_pass, sapp.width(), sapp.height())
|
||||
create_default_pass(ctx.clear_pass)
|
||||
}
|
||||
.passthru {
|
||||
gfx.begin_default_pass(gg.dontcare_pass, sapp.width(), sapp.height())
|
||||
create_default_pass(gg.dontcare_pass)
|
||||
}
|
||||
}
|
||||
gfx.begin_pass(pass)
|
||||
sgl.draw()
|
||||
gfx.end_pass()
|
||||
gfx.commit()
|
||||
|
|
|
@ -65,9 +65,11 @@ pub fn make_pipeline(desc &PipelineDesc) Pipeline {
|
|||
return C.sg_make_pipeline(desc)
|
||||
}
|
||||
|
||||
// make_attachments creates an `Attachments` instance from `const_desc`.
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
@[inline]
|
||||
pub fn make_pass(desc &PassDesc) Pass {
|
||||
return C.sg_make_pass(desc)
|
||||
pub fn make_attachments(const_desc &AttachmentsDesc) Attachments {
|
||||
return C.sg_make_attachments(const_desc)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
|
@ -95,9 +97,11 @@ pub fn destroy_pipeline(pip Pipeline) {
|
|||
C.sg_destroy_pipeline(pip)
|
||||
}
|
||||
|
||||
// destroy_attachments destroys the `atts` `Attachments`
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
@[inline]
|
||||
pub fn destroy_pass(pass Pass) {
|
||||
C.sg_destroy_pass(pass)
|
||||
pub fn destroy_attachments(atts Attachments) {
|
||||
C.sg_destroy_attachments(atts)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
|
@ -121,14 +125,16 @@ pub fn query_buffer_overflow(buf Buffer) bool {
|
|||
}
|
||||
|
||||
// rendering functions
|
||||
@[inline]
|
||||
pub fn begin_default_pass(actions &PassAction, width int, height int) {
|
||||
C.sg_begin_default_pass(actions, width, height)
|
||||
}
|
||||
|
||||
@[deprecated: 'use begin_pass instead, please see examples/sokol/* for how to utilize new unified begin_pass']
|
||||
@[inline]
|
||||
pub fn begin_pass(pass Pass, actions &PassAction) {
|
||||
C.sg_begin_pass(pass, actions)
|
||||
pub fn begin_default_pass(actions &PassAction, width int, height int) {}
|
||||
|
||||
// begin_pass begins a rendering pass.
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
@[inline]
|
||||
pub fn begin_pass(const_pass &Pass) {
|
||||
C.sg_begin_pass(const_pass)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
|
@ -218,9 +224,11 @@ pub fn query_pipeline_state(pip Pipeline) ResourceState {
|
|||
return ResourceState(C.sg_query_pipeline_state(pip))
|
||||
}
|
||||
|
||||
// query_attachments_state returns the current state of a resource (INITIAL, ALLOC, VALID, FAILED, INVALID)
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
@[inline]
|
||||
pub fn query_pass_state(pass Pass) ResourceState {
|
||||
return ResourceState(C.sg_query_pass_state(pass))
|
||||
pub fn query_attachments_state(atts Attachments) ResourceState {
|
||||
return ResourceState(C.sg_query_attachments_state(atts))
|
||||
}
|
||||
|
||||
// get runtime information about a resource
|
||||
|
@ -244,9 +252,11 @@ pub fn query_pipeline_info(pip Pipeline) PipelineInfo {
|
|||
return C.sg_query_pipeline_info(pip)
|
||||
}
|
||||
|
||||
// query_attachments_info returns runtime information about the `atts` / `Attachments`.
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
@[inline]
|
||||
pub fn query_pass_info(pass Pass) PassInfo {
|
||||
return C.sg_query_pass_info(pass)
|
||||
pub fn query_attachments_info(atts Attachments) AttachmentsInfo {
|
||||
return C.sg_query_attachments_info(atts)
|
||||
}
|
||||
|
||||
// get resource creation desc struct with their default values replaced
|
||||
|
@ -270,25 +280,11 @@ pub fn query_pipeline_defaults(desc &Pipeline) PipelineDesc {
|
|||
return C.sg_query_pipeline_defaults(unsafe { &PipelineDesc(voidptr(desc)) })
|
||||
}
|
||||
|
||||
// query_attachments_defaults returns `AttachmentsDesc` with default values replaced.
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
@[inline]
|
||||
pub fn query_pass_defaults(desc &Pass) PassDesc {
|
||||
return C.sg_query_pass_defaults(unsafe { &PassDesc(voidptr(desc)) })
|
||||
}
|
||||
|
||||
// rendering contexts (optional)
|
||||
@[inline]
|
||||
pub fn setup_context() Context {
|
||||
return C.sg_setup_context()
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn activate_context(ctx_id Context) {
|
||||
C.sg_activate_context(ctx_id)
|
||||
}
|
||||
|
||||
@[inline]
|
||||
pub fn discard_context(ctx_id Context) {
|
||||
C.sg_discard_context(ctx_id)
|
||||
pub fn query_attachments_defaults(desc &AttachmentsDesc) AttachmentsDesc {
|
||||
return C.sg_query_attachments_defaults(unsafe { &AttachmentsDesc(voidptr(desc)) })
|
||||
}
|
||||
|
||||
// frame stats
|
||||
|
|
|
@ -17,13 +17,13 @@ fn C.sg_make_image(const_desc &C.sg_image_desc) C.sg_image
|
|||
fn C.sg_make_sampler(const_desc &C.sg_sampler_desc) C.sg_sampler
|
||||
fn C.sg_make_shader(const_desc &C.sg_shader_desc) C.sg_shader
|
||||
fn C.sg_make_pipeline(const_desc &C.sg_pipeline_desc) C.sg_pipeline
|
||||
fn C.sg_make_pass(const_desc &C.sg_pass_desc) C.sg_pass
|
||||
fn C.sg_make_attachments(const_desc &C.sg_attachments_desc) C.sg_attachments
|
||||
fn C.sg_destroy_buffer(buf C.sg_buffer)
|
||||
fn C.sg_destroy_image(img C.sg_image)
|
||||
fn C.sg_destroy_sampler(smp C.sg_sampler)
|
||||
fn C.sg_destroy_shader(shd C.sg_shader)
|
||||
fn C.sg_destroy_pipeline(pip C.sg_pipeline)
|
||||
fn C.sg_destroy_pass(pass C.sg_pass)
|
||||
fn C.sg_destroy_attachments(atts C.sg_attachments)
|
||||
fn C.sg_update_buffer(buf C.sg_buffer, data &C.sg_range)
|
||||
fn C.sg_update_image(img C.sg_image, data &C.sg_image_data)
|
||||
fn C.sg_append_buffer(buf C.sg_buffer, data &C.sg_range) int
|
||||
|
@ -31,8 +31,7 @@ fn C.sg_query_buffer_overflow(buf C.sg_buffer) bool
|
|||
fn C.sg_query_buffer_will_overflow(buf C.sg_buffer, size usize) bool
|
||||
|
||||
// rendering functions
|
||||
fn C.sg_begin_default_pass(actions &C.sg_pass_action, width int, height int)
|
||||
fn C.sg_begin_pass(pass C.sg_pass, actions &C.sg_pass_action)
|
||||
fn C.sg_begin_pass(const_pass &C.sg_pass)
|
||||
fn C.sg_apply_viewport(x int, y int, width int, height int, origin_top_left bool)
|
||||
fn C.sg_apply_viewportf(x f32, y f32, width f32, height f32, origin_top_left bool)
|
||||
fn C.sg_apply_scissor_rect(x int, y int, width int, height int, origin_top_left bool)
|
||||
|
@ -57,7 +56,7 @@ fn C.sg_query_image_state(img C.sg_image) ResourceState
|
|||
fn C.sg_query_sampler_state(smp C.sg_sampler) ResourceState
|
||||
fn C.sg_query_shader_state(shd C.sg_shader) ResourceState
|
||||
fn C.sg_query_pipeline_state(pip C.sg_pipeline) ResourceState
|
||||
fn C.sg_query_pass_state(pass C.sg_pass) ResourceState
|
||||
fn C.sg_query_attachments_state(atts C.sg_attachments) ResourceState
|
||||
|
||||
// get runtime information about a resource
|
||||
fn C.sg_query_buffer_info(buf C.sg_buffer) C.sg_buffer_info
|
||||
|
@ -65,7 +64,7 @@ fn C.sg_query_image_info(img C.sg_image) C.sg_image_info
|
|||
fn C.sg_query_sampler_info(smp C.sg_sampler) C.sg_sampler_info
|
||||
fn C.sg_query_shader_info(shd C.sg_shader) C.sg_shader_info
|
||||
fn C.sg_query_pipeline_info(pip C.sg_pipeline) C.sg_pipeline_info
|
||||
fn C.sg_query_pass_info(pass C.sg_pass) C.sg_pass_info
|
||||
fn C.sg_query_attachments_info(atts C.sg_attachments) C.sg_attachments_info
|
||||
|
||||
// get desc structs matching a specific resource (NOTE that not all creation attributes may be provided)
|
||||
fn C.sg_query_buffer_desc(buf C.sg_buffer) C.sg_buffer_desc
|
||||
|
@ -73,7 +72,7 @@ fn C.sg_query_image_desc(img C.sg_image) C.sg_image_desc
|
|||
fn C.sg_query_sampler_desc(smp C.sg_sampler) C.sg_sampler_desc
|
||||
fn C.sg_query_shader_desc(shd C.sg_shader) C.sg_shader_desc
|
||||
fn C.sg_query_pipeline_desc(pip C.sg_pipeline) C.sg_pipeline_desc
|
||||
fn C.sg_query_pass_desc(pass C.sg_pass) C.sg_pass_desc
|
||||
fn C.sg_query_attachments_desc(atts C.sg_attachments) C.sg_attachments_desc
|
||||
|
||||
// get resource creation desc struct with their default values replaced
|
||||
fn C.sg_query_buffer_defaults(const_desc &C.sg_buffer_desc) C.sg_buffer_desc
|
||||
|
@ -81,7 +80,7 @@ fn C.sg_query_image_defaults(const_desc &C.sg_image_desc) C.sg_image_desc
|
|||
fn C.sg_query_sampler_defaults(const_desc &C.sg_sampler_desc) C.sg_sampler_desc
|
||||
fn C.sg_query_shader_defaults(const_desc &C.sg_shader_desc) C.sg_shader_desc
|
||||
fn C.sg_query_pipeline_defaults(const_desc &C.sg_pipeline_desc) C.sg_pipeline_desc
|
||||
fn C.sg_query_pass_defaults(const_desc &C.sg_pass_desc) C.sg_pass_desc
|
||||
fn C.sg_query_attachments_defaults(const_desc &C.sg_attachments_desc) C.sg_attachments_desc
|
||||
|
||||
// separate resource allocation and initialization (for async setup)
|
||||
fn C.sg_alloc_buffer() C.sg_buffer
|
||||
|
@ -89,39 +88,34 @@ fn C.sg_alloc_image() C.sg_image
|
|||
fn C.sg_alloc_sampler() C.sg_sampler
|
||||
fn C.sg_alloc_shader() C.sg_shader
|
||||
fn C.sg_alloc_pipeline() C.sg_pipeline
|
||||
fn C.sg_alloc_pass() C.sg_pass
|
||||
fn C.sg_alloc_attachments() C.sg_attachments
|
||||
fn C.sg_dealloc_buffer(buf C.sg_buffer)
|
||||
fn C.sg_dealloc_image(img C.sg_image)
|
||||
fn C.sg_dealloc_sampler(smp C.sg_sampler)
|
||||
fn C.sg_dealloc_shader(shd C.sg_shader)
|
||||
fn C.sg_dealloc_pipeline(pip C.sg_pipeline)
|
||||
fn C.sg_dealloc_pass(pass C.sg_pass)
|
||||
fn C.sg_dealloc_attachments(atts C.sg_attachments)
|
||||
fn C.sg_init_buffer(buf C.sg_buffer, const_desc &C.sg_buffer_desc)
|
||||
fn C.sg_init_image(img C.sg_image, const_desc &C.sg_buffer_desc)
|
||||
fn C.sg_init_sampler(smg C.sg_sampler, const_desc &C.sg_sampler_desc)
|
||||
fn C.sg_init_shader(shd C.sg_shader, const_desc &C.sg_shader_desc)
|
||||
fn C.sg_init_pipeline(pip C.sg_pipeline, const_desc &C.sg_pipeline_desc)
|
||||
fn C.sg_init_pass(pass C.sg_pass, const_desc &C.sg_pass_desc)
|
||||
fn C.sg_init_attachments(atts C.sg_attachments, const_desc &C.sg_attachments_desc)
|
||||
fn C.sg_uninit_buffer(buf C.sg_buffer)
|
||||
fn C.sg_uninit_image(img C.sg_image)
|
||||
fn C.sg_uninit_sampler(smp C.sg_sampler)
|
||||
fn C.sg_uninit_shader(shd C.sg_shader)
|
||||
fn C.sg_uninit_pipeline(pip C.sg_pipeline)
|
||||
fn C.sg_uninit_pass(pass C.sg_pass)
|
||||
fn C.sg_uninit_attachments(atts C.sg_attachments)
|
||||
fn C.sg_fail_buffer(buf C.sg_buffer)
|
||||
fn C.sg_fail_image(img C.sg_image)
|
||||
fn C.sg_fail_sampler(smp C.sg_sampler)
|
||||
fn C.sg_fail_shader(shd C.sg_shader)
|
||||
fn C.sg_fail_pipeline(pip C.sg_pipeline)
|
||||
fn C.sg_fail_pass(pass C.sg_pass)
|
||||
fn C.sg_fail_attachments(atts C.sg_attachments)
|
||||
|
||||
// frame stats
|
||||
fn C.sg_enable_frame_stats()
|
||||
fn C.sg_disable_frame_stats()
|
||||
fn C.sg_frame_stats_enabled() bool
|
||||
fn C.sg_query_frame_stats() C.sg_frame_stats
|
||||
|
||||
// rendering contexts (optional)
|
||||
fn C.sg_setup_context() C.sg_context
|
||||
fn C.sg_activate_context(ctx_id C.sg_context)
|
||||
fn C.sg_discard_context(ctx_id C.sg_context)
|
||||
|
|
|
@ -3,64 +3,28 @@ module gfx
|
|||
// C.sg_desc describes
|
||||
pub struct C.sg_desc {
|
||||
pub mut:
|
||||
_start_canary u32
|
||||
buffer_pool_size int
|
||||
image_pool_size int
|
||||
sampler_pool_size int
|
||||
shader_pool_size int
|
||||
pipeline_pool_size int
|
||||
pass_pool_size int
|
||||
context_pool_size int
|
||||
attachments_pool_size int
|
||||
uniform_buffer_size int
|
||||
max_commit_listeners int
|
||||
disable_validation bool // disable validation layer even in debug mode, useful for tests
|
||||
mtl_force_managed_storage_mode bool // for debugging: use Metal managed storage mode for resources even with UMA
|
||||
mtl_use_command_buffer_with_retained_references bool // Metal: use a managed MTLCommandBuffer which ref-counts used resources
|
||||
wgpu_disable_bindgroups_cache bool // set to true to disable the WebGPU backend BindGroup cache
|
||||
wgpu_bindgroups_cache_size int // number of slots in the WebGPU bindgroup cache (must be 2^N)
|
||||
//
|
||||
allocator C.sg_allocator
|
||||
logger C.sg_logger
|
||||
//
|
||||
context C.sg_context_desc
|
||||
logger C.sg_logger // optional log function override
|
||||
environment C.sg_environment
|
||||
_end_canary u32
|
||||
}
|
||||
|
||||
pub type Desc = C.sg_desc
|
||||
|
||||
pub struct C.sg_context_desc {
|
||||
pub mut:
|
||||
color_format PixelFormat
|
||||
depth_format PixelFormat
|
||||
sample_count int
|
||||
gl GLContextDesc
|
||||
metal MetalContextDesc
|
||||
d3d11 D3D11ContextDesc
|
||||
// TODO C.sg_wgpu_context_desc wgpu;
|
||||
}
|
||||
|
||||
pub type ContextDesc = C.sg_context_desc
|
||||
|
||||
pub struct C.sg_gl_context_desc {
|
||||
force_gles2 bool
|
||||
}
|
||||
|
||||
pub type GLContextDesc = C.sg_gl_context_desc
|
||||
|
||||
pub struct C.sg_metal_context_desc {
|
||||
device voidptr
|
||||
renderpass_descriptor_cb fn () voidptr = unsafe { nil }
|
||||
drawable_cb fn () voidptr = unsafe { nil }
|
||||
}
|
||||
|
||||
pub type MetalContextDesc = C.sg_metal_context_desc
|
||||
|
||||
pub struct C.sg_d3d11_context_desc {
|
||||
device voidptr
|
||||
device_context voidptr
|
||||
render_target_view_cb fn () voidptr = unsafe { nil }
|
||||
depth_stencil_view_cb fn () voidptr = unsafe { nil }
|
||||
}
|
||||
|
||||
pub type D3D11ContextDesc = C.sg_d3d11_context_desc
|
||||
|
||||
pub struct C.sg_color_target_state {
|
||||
pub mut:
|
||||
pixel_format PixelFormat
|
||||
|
@ -108,6 +72,47 @@ pub fn (mut p C.sg_pipeline) free() {
|
|||
C.sg_destroy_pipeline(*p)
|
||||
}
|
||||
|
||||
pub struct C.sg_attachments {
|
||||
id u32
|
||||
}
|
||||
|
||||
// Attachments represents data that can be attached to a render pass.
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
pub type Attachments = C.sg_attachments
|
||||
|
||||
// free frees the resources occupied by the struct
|
||||
pub fn (mut a C.sg_attachments) free() {
|
||||
C.sg_destroy_attachments(*a)
|
||||
}
|
||||
|
||||
pub struct C.sg_attachment_desc {
|
||||
pub mut:
|
||||
image Image
|
||||
mip_level int
|
||||
slice int
|
||||
}
|
||||
|
||||
pub type AttachmentDesc = C.sg_attachment_desc
|
||||
|
||||
pub struct C.sg_attachments_desc {
|
||||
pub mut:
|
||||
_start_canary u32
|
||||
colors [4]AttachmentDesc
|
||||
resolves [4]AttachmentDesc
|
||||
depth_stencil AttachmentDesc
|
||||
label &char = unsafe { nil }
|
||||
_end_canary u32
|
||||
}
|
||||
|
||||
pub type AttachmentsDesc = C.sg_attachments_desc
|
||||
|
||||
pub struct C.sg_attachments_info {
|
||||
pub mut:
|
||||
slot SlotInfo // resource pool slot info
|
||||
}
|
||||
|
||||
pub type AttachmentsInfo = C.sg_attachments_info
|
||||
|
||||
pub struct C.sg_bindings {
|
||||
pub mut:
|
||||
_start_canary u32
|
||||
|
@ -314,13 +319,6 @@ pub:
|
|||
|
||||
pub type ShaderInfo = C.sg_shader_info
|
||||
|
||||
pub struct C.sg_context {
|
||||
pub:
|
||||
id u32
|
||||
}
|
||||
|
||||
pub type Context = C.sg_context
|
||||
|
||||
pub struct C.sg_range {
|
||||
pub mut:
|
||||
ptr voidptr
|
||||
|
@ -350,21 +348,6 @@ pub fn (mut s Shader) free() {
|
|||
C.sg_destroy_shader(*s)
|
||||
}
|
||||
|
||||
pub struct C.sg_pass_desc {
|
||||
pub mut:
|
||||
color_attachments [4]PassAttachmentDesc
|
||||
depth_stencil_attachment PassAttachmentDesc
|
||||
label &char
|
||||
}
|
||||
|
||||
pub type PassDesc = C.sg_pass_desc
|
||||
|
||||
pub struct C.sg_pass_info {
|
||||
info SlotInfo
|
||||
}
|
||||
|
||||
pub type PassInfo = C.sg_pass_info
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_frame_stats_gl {
|
||||
num_bind_buffer u32
|
||||
|
@ -571,16 +554,73 @@ pub mut:
|
|||
|
||||
pub type PassAction = C.sg_pass_action
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_metal_swapchain {
|
||||
pub mut:
|
||||
current_drawable voidptr
|
||||
depth_stencil_texture voidptr // MTLTexture
|
||||
msaa_color_texture voidptr // MTLTexture
|
||||
}
|
||||
|
||||
pub type MetalSwapchain = C.sg_metal_swapchain
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_d3d11_swapchain {
|
||||
pub mut:
|
||||
render_view voidptr // ID3D11RenderTargetView
|
||||
resolve_view voidptr // ID3D11RenderTargetView
|
||||
depth_stencil_view voidptr // ID3D11DepthStencilView
|
||||
}
|
||||
|
||||
pub type D3d11Swapchain = C.sg_d3d11_swapchain
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_wgpu_swapchain {
|
||||
pub mut:
|
||||
render_view voidptr // WGPUTextureView
|
||||
resolve_view voidptr // WGPUTextureView
|
||||
depth_stencil_view voidptr // WGPUTextureView
|
||||
}
|
||||
|
||||
pub type WgpuSwapchain = C.sg_wgpu_swapchain
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_gl_swapchain {
|
||||
pub mut:
|
||||
framebuffer u32
|
||||
}
|
||||
|
||||
pub type GlSwapchain = C.sg_gl_swapchain
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_swapchain {
|
||||
pub mut:
|
||||
width int
|
||||
height int
|
||||
sample_count int
|
||||
color_format PixelFormat
|
||||
depth_format PixelFormat
|
||||
metal MetalSwapchain
|
||||
d3d11 D3d11Swapchain
|
||||
wgpu WgpuSwapchain
|
||||
gl GlSwapchain
|
||||
}
|
||||
|
||||
pub type Swapchain = C.sg_swapchain
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_pass {
|
||||
id u32
|
||||
pub mut:
|
||||
_start_canary u32
|
||||
action PassAction
|
||||
attachments Attachments
|
||||
swapchain Swapchain
|
||||
label &char = unsafe { nil }
|
||||
_end_canary u32
|
||||
}
|
||||
|
||||
pub type Pass = C.sg_pass
|
||||
|
||||
pub fn (mut p Pass) free() {
|
||||
C.sg_destroy_pass(*p)
|
||||
}
|
||||
|
||||
pub struct C.sg_buffer_desc {
|
||||
pub mut:
|
||||
size usize
|
||||
|
@ -745,7 +785,7 @@ pub:
|
|||
max_image_size_array int // max width/height pf SG_IMAGETYPE_ARRAY images
|
||||
max_image_array_layers int // max number of layers in SG_IMAGETYPE_ARRAY images
|
||||
max_vertex_attrs int // <= SG_MAX_VERTEX_ATTRIBUTES (only on some GLES2 impls)
|
||||
gl_max_vertex_uniform_vectors int // <= GL_MAX_VERTEX_UNIFORM_VECTORS (only on GL backends)
|
||||
gl_max_vertex_uniform_components int // <= GL_MAX_VERTEX_UNIFORM_COMPONENTS (only on GL backends)
|
||||
gl_max_combined_texture_image_units int // <= GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS (only on GL backends)
|
||||
}
|
||||
|
||||
|
@ -868,21 +908,51 @@ pub:
|
|||
|
||||
pub type PixelFormatInfo = C.sg_pixelformat_info
|
||||
|
||||
pub struct C.sg_pass_attachment_desc {
|
||||
@[typedef]
|
||||
pub struct C.sg_environment_defaults {
|
||||
pub mut:
|
||||
image Image
|
||||
mip_level int
|
||||
slice int
|
||||
// image sg_image
|
||||
// mip_level int
|
||||
// union {
|
||||
// face int
|
||||
// layer int
|
||||
// slice int
|
||||
// }
|
||||
color_format PixelFormat
|
||||
depth_format PixelFormat
|
||||
sample_count int
|
||||
}
|
||||
|
||||
pub type PassAttachmentDesc = C.sg_pass_attachment_desc
|
||||
pub type EnvironmentDefaults = C.sg_environment_defaults
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_metal_environment {
|
||||
pub mut:
|
||||
device voidptr
|
||||
}
|
||||
|
||||
pub type MetalEnvironment = C.sg_metal_environment
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_d3d11_environment {
|
||||
pub mut:
|
||||
device voidptr
|
||||
device_context voidptr
|
||||
}
|
||||
|
||||
pub type D3d11Environment = C.sg_d3d11_environment
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_wgpu_environment {
|
||||
pub mut:
|
||||
device voidptr
|
||||
}
|
||||
|
||||
pub type WgpuEnvironment = C.sg_wgpu_environment
|
||||
|
||||
@[typedef]
|
||||
pub struct C.sg_environment {
|
||||
pub mut:
|
||||
defaults EnvironmentDefaults
|
||||
metal MetalEnvironment
|
||||
d3d11 D3d11Environment
|
||||
wgpu WgpuEnvironment
|
||||
}
|
||||
|
||||
pub type Environment = C.sg_environment
|
||||
|
||||
// C.sg_commit_listener is used with sg_add_commit_listener, to add a callback,
|
||||
// which will be called in sg_commit(). This is useful for libraries building
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
module gfx
|
||||
|
||||
@[deprecated: 'use create_clear_pass_action instead']
|
||||
@[deprecated_after: '2024-09-03']
|
||||
pub fn create_clear_pass(r f32, g f32, b f32, a f32) PassAction {
|
||||
return create_clear_pass_action(r, g, b, a)
|
||||
}
|
||||
|
||||
// create_clear_pass_action returns a *clearing* `PassAction` that clears the `Pass`
|
||||
// with the color defined by the color components `r`ed,`g`reen, `b`lue and `a`lpha.
|
||||
pub fn create_clear_pass_action(r f32, g f32, b f32, a f32) PassAction {
|
||||
mut color_action := ColorAttachmentAction{
|
||||
load_action: .clear // unsafe { Action(C.SG_ACTION_CLEAR) }
|
||||
load_action: .clear
|
||||
clear_value: Color{
|
||||
r: r
|
||||
g: g
|
||||
|
|
|
@ -10,28 +10,70 @@ pub const used_import = gfx.used_import
|
|||
__global g_desc C.sapp_desc
|
||||
|
||||
pub fn create_desc() gfx.Desc {
|
||||
metal_desc := gfx.MetalContextDesc{
|
||||
device: metal_get_device()
|
||||
renderpass_descriptor_cb: metal_get_renderpass_descriptor
|
||||
drawable_cb: metal_get_drawable
|
||||
}
|
||||
d3d11_desc := gfx.D3D11ContextDesc{
|
||||
device: d3d11_get_device()
|
||||
device_context: d3d11_get_device_context()
|
||||
render_target_view_cb: d3d11_get_render_target_view
|
||||
depth_stencil_view_cb: d3d11_get_depth_stencil_view
|
||||
}
|
||||
|
||||
return gfx.Desc{
|
||||
context: gfx.ContextDesc{
|
||||
metal: metal_desc
|
||||
d3d11: d3d11_desc
|
||||
color_format: .bgra8
|
||||
}
|
||||
environment: glue_environment()
|
||||
image_pool_size: 1000
|
||||
}
|
||||
}
|
||||
|
||||
// create_default_pass creates a default `gfx.Pass` compatible with `sapp` and `sokol.gfx.begin_pass/1`.
|
||||
pub fn create_default_pass(action gfx.PassAction) gfx.Pass {
|
||||
return gfx.Pass{
|
||||
action: action
|
||||
swapchain: glue_swapchain()
|
||||
}
|
||||
}
|
||||
|
||||
// glue_environment returns a `gfx.Environment` compatible for use with `sapp` specific `gfx.Pass`es.
|
||||
// The retuned `gfx.Environment` can be used when rendering via `sapp`.
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
pub fn glue_environment() gfx.Environment {
|
||||
mut env := gfx.Environment{}
|
||||
unsafe { vmemset(&env, 0, int(sizeof(env))) }
|
||||
env.defaults.color_format = gfx.PixelFormat.from(color_format()) or { gfx.PixelFormat.@none }
|
||||
env.defaults.depth_format = gfx.PixelFormat.from(depth_format()) or { gfx.PixelFormat.@none }
|
||||
env.defaults.sample_count = sample_count()
|
||||
$if macos && !darwin_sokol_glcore33 ? {
|
||||
env.metal.device = metal_get_device()
|
||||
}
|
||||
// if windows and dx3d11
|
||||
// env.d3d11.device = d3d11_get_device()
|
||||
// env.d3d11.device_context = d3d11_get_device_context()
|
||||
// if webgpu
|
||||
// env.wgpu.device = wgpu_get_device()
|
||||
return env
|
||||
}
|
||||
|
||||
// glue_swapchain returns a `gfx.Swapchain` compatible for use with `sapp` specific display/rendering `gfx.Pass`es.
|
||||
// The retuned `gfx.Swapchain` can be used when rendering via `sapp`.
|
||||
// See also: documentation at the top of thirdparty/sokol/sokol_gfx.h
|
||||
pub fn glue_swapchain() gfx.Swapchain {
|
||||
mut swapchain := gfx.Swapchain{}
|
||||
unsafe { vmemset(&swapchain, 0, int(sizeof(swapchain))) }
|
||||
swapchain.width = width()
|
||||
swapchain.height = height()
|
||||
swapchain.sample_count = sample_count()
|
||||
swapchain.color_format = gfx.PixelFormat.from(color_format()) or { gfx.PixelFormat.@none }
|
||||
swapchain.depth_format = gfx.PixelFormat.from(depth_format()) or { gfx.PixelFormat.@none }
|
||||
$if macos && !darwin_sokol_glcore33 ? {
|
||||
swapchain.metal.current_drawable = metal_get_current_drawable()
|
||||
swapchain.metal.depth_stencil_texture = metal_get_depth_stencil_texture()
|
||||
swapchain.metal.msaa_color_texture = metal_get_msaa_color_texture()
|
||||
}
|
||||
// if windows and dx3d11
|
||||
// swapchain.d3d11.render_view = d3d11_get_render_view()
|
||||
// swapchain.d3d11.resolve_view = d3d11_get_resolve_view()
|
||||
// swapchain.d3d11.depth_stencil_view = d3d11_get_depth_stencil_view()
|
||||
// if webgpu
|
||||
// swapchain.wgpu.render_view = wgpu_get_render_view()
|
||||
// swapchain.wgpu.resolve_view = wgpu_get_resolve_view()
|
||||
// swapchain.wgpu.depth_stencil_view = wgpu_get_depth_stencil_view()
|
||||
$else {
|
||||
swapchain.gl.framebuffer = gl_get_framebuffer()
|
||||
}
|
||||
return swapchain
|
||||
}
|
||||
|
||||
// returns true after sokol-app has been initialized
|
||||
@[inline]
|
||||
pub fn isvalid() bool {
|
||||
|
@ -210,16 +252,19 @@ pub fn metal_get_device() voidptr {
|
|||
return voidptr(C.sapp_metal_get_device())
|
||||
}
|
||||
|
||||
// Metal: get ARC-bridged pointer to this frame's renderpass descriptor
|
||||
@[inline]
|
||||
pub fn metal_get_renderpass_descriptor() voidptr {
|
||||
return voidptr(C.sapp_metal_get_renderpass_descriptor())
|
||||
// Metal: get ARC-bridged pointer to current drawable
|
||||
pub fn metal_get_current_drawable() voidptr {
|
||||
return C.sapp_metal_get_current_drawable()
|
||||
}
|
||||
|
||||
// Metal: get ARC-bridged pointer to current drawable
|
||||
@[inline]
|
||||
pub fn metal_get_drawable() voidptr {
|
||||
return voidptr(C.sapp_metal_get_drawable())
|
||||
// Metal: get bridged pointer to MTKView's depth-stencil texture of type MTLTexture
|
||||
pub fn metal_get_depth_stencil_texture() voidptr {
|
||||
return C.sapp_metal_get_depth_stencil_texture()
|
||||
}
|
||||
|
||||
// Metal: get bridged pointer to MTKView's msaa-color-texture of type MTLTexture (may be null)
|
||||
pub fn metal_get_msaa_color_texture() voidptr {
|
||||
return C.sapp_metal_get_msaa_color_texture()
|
||||
}
|
||||
|
||||
// macOS: get ARC-bridged pointer to macOS NSWindow
|
||||
|
@ -246,10 +291,16 @@ pub fn d3d11_get_device_context() voidptr {
|
|||
return voidptr(C.sapp_d3d11_get_device_context())
|
||||
}
|
||||
|
||||
// D3D11: get pointer to ID3D11RenderTargetView object
|
||||
// D3D11: get pointer to ID3D11RenderView object
|
||||
@[inline]
|
||||
pub fn d3d11_get_render_target_view() voidptr {
|
||||
return voidptr(C.sapp_d3d11_get_render_target_view())
|
||||
pub fn d3d11_get_render_view() voidptr {
|
||||
return voidptr(C.sapp_d3d11_get_render_view())
|
||||
}
|
||||
|
||||
// D3D11: get pointer ID3D11RenderTargetView object for msaa-resolve (may return null)
|
||||
@[inline]
|
||||
pub fn d3d11_get_resolve_view() voidptr {
|
||||
return C.sapp_d3d11_get_resolve_view()
|
||||
}
|
||||
|
||||
// D3D11: get pointer to ID3D11DepthStencilView
|
||||
|
@ -264,6 +315,32 @@ pub fn win32_get_hwnd() voidptr {
|
|||
return voidptr(C.sapp_win32_get_hwnd())
|
||||
}
|
||||
|
||||
// WebGPU: get WGPUDevice handle
|
||||
pub fn wgpu_get_device() voidptr {
|
||||
return C.sapp_wgpu_get_device()
|
||||
}
|
||||
|
||||
// WebGPU: get swapchain's WGPUTextureView handle for rendering
|
||||
pub fn wgpu_get_render_view() voidptr {
|
||||
return C.sapp_wgpu_get_render_view()
|
||||
}
|
||||
|
||||
// WebGPU: get swapchain's MSAA-resolve WGPUTextureView (may return null)
|
||||
pub fn wgpu_get_resolve_view() voidptr {
|
||||
return C.sapp_wgpu_get_resolve_view()
|
||||
}
|
||||
|
||||
// WebGPU: get swapchain's WGPUTextureView for the depth-stencil surface
|
||||
pub fn wgpu_get_depth_stencil_view() voidptr {
|
||||
return C.sapp_wgpu_get_depth_stencil_view()
|
||||
}
|
||||
|
||||
// GL: get framebuffer object
|
||||
@[inline]
|
||||
pub fn gl_get_framebuffer() u32 {
|
||||
return C.sapp_gl_get_framebuffer()
|
||||
}
|
||||
|
||||
// Android: get native activity handle
|
||||
@[inline]
|
||||
pub fn android_get_native_activity() voidptr {
|
||||
|
|
|
@ -110,11 +110,14 @@ fn C.sapp_html5_ask_leave_site(ask bool)
|
|||
// Metal: get ARC-bridged pointer to Metal device object
|
||||
fn C.sapp_metal_get_device() voidptr
|
||||
|
||||
// Metal: get ARC-bridged pointer to this frame's renderpass descriptor
|
||||
fn C.sapp_metal_get_renderpass_descriptor() voidptr
|
||||
|
||||
// Metal: get ARC-bridged pointer to current drawable
|
||||
fn C.sapp_metal_get_drawable() voidptr
|
||||
fn C.sapp_metal_get_current_drawable() voidptr
|
||||
|
||||
// Metal: get bridged pointer to MTKView's depth-stencil texture of type MTLTexture
|
||||
fn C.sapp_metal_get_depth_stencil_texture() voidptr
|
||||
|
||||
// Metal: get bridged pointer to MTKView's msaa-color-texture of type MTLTexture (may be null)
|
||||
fn C.sapp_metal_get_msaa_color_texture() voidptr
|
||||
|
||||
// macOS: get ARC-bridged pointer to macOS NSWindow
|
||||
fn C.sapp_macos_get_window() voidptr
|
||||
|
@ -131,8 +134,11 @@ fn C.sapp_d3d11_get_device_context() voidptr
|
|||
// D3D11: get pointer to IDXGISwapChain object
|
||||
fn C.sapp_d3d11_get_swap_chain() voidptr
|
||||
|
||||
// D3D11: get pointer to ID3D11RenderTargetView object
|
||||
fn C.sapp_d3d11_get_render_target_view() voidptr
|
||||
// D3D11: get pointer to ID3D11RenderView object
|
||||
fn C.sapp_d3d11_get_render_view() voidptr
|
||||
|
||||
// D3D11: get pointer ID3D11RenderTargetView object for msaa-resolve (may return null)
|
||||
fn C.sapp_d3d11_get_resolve_view() voidptr
|
||||
|
||||
// D3D11: get pointer to ID3D11DepthStencilView
|
||||
fn C.sapp_d3d11_get_depth_stencil_view() voidptr
|
||||
|
@ -152,5 +158,8 @@ fn C.sapp_wgpu_get_resolve_view() voidptr
|
|||
// WebGPU: get swapchain's WGPUTextureView for the depth-stencil surface
|
||||
fn C.sapp_wgpu_get_depth_stencil_view() voidptr
|
||||
|
||||
// GL: get framebuffer object
|
||||
fn C.sapp_gl_get_framebuffer() u32
|
||||
|
||||
// Android: get native activity handle
|
||||
fn C.sapp_android_get_native_activity() voidptr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue