diff --git a/examples/sokol/01_cubes/cube.v b/examples/sokol/01_cubes/cube.v index 8b9b5a0cb6..7cf4432dbf 100644 --- a/examples/sokol/01_cubes/cube.v +++ b/examples/sokol/01_cubes/cube.v @@ -322,7 +322,7 @@ fn my_init(mut app App) { // 3d pipeline mut pipdesc := gfx.PipelineDesc{} - unsafe { C.memset(&pipdesc, 0, sizeof(pipdesc)) } + unsafe { vmemset(&pipdesc, 0, int(sizeof(pipdesc))) } color_state := gfx.ColorState{ blend: gfx.BlendState{ diff --git a/examples/sokol/02_cubes_glsl/cube_glsl.v b/examples/sokol/02_cubes_glsl/cube_glsl.v index 666353f11e..aa43c63488 100644 --- a/examples/sokol/02_cubes_glsl/cube_glsl.v +++ b/examples/sokol/02_cubes_glsl/cube_glsl.v @@ -277,7 +277,7 @@ fn init_cube_glsl(mut app App) { ] mut vert_buffer_desc := gfx.BufferDesc{label: c'cube-vertices'} - unsafe { C.memset(&vert_buffer_desc, 0, sizeof(vert_buffer_desc)) } + unsafe { vmemset(&vert_buffer_desc, 0, int(sizeof(vert_buffer_desc))) } vert_buffer_desc.size = usize(vertices.len * int(sizeof(Vertex_t))) vert_buffer_desc.data = gfx.Range{ @@ -300,7 +300,7 @@ fn init_cube_glsl(mut app App) { ] mut index_buffer_desc := gfx.BufferDesc{label: c'cube-indices'} - unsafe { C.memset(&index_buffer_desc, 0, sizeof(index_buffer_desc)) } + unsafe { vmemset(&index_buffer_desc, 0, int(sizeof(index_buffer_desc))) } index_buffer_desc.size = usize(indices.len * int(sizeof(u16))) index_buffer_desc.data = gfx.Range{ @@ -315,7 +315,7 @@ fn init_cube_glsl(mut app App) { shader := gfx.make_shader(C.cube_shader_desc(C.sg_query_backend())) mut pipdesc := gfx.PipelineDesc{} - unsafe { C.memset(&pipdesc, 0, sizeof(pipdesc)) } + unsafe { vmemset(&pipdesc, 0, int(sizeof(pipdesc))) } pipdesc.layout.buffers[0].stride = int(sizeof(Vertex_t)) // the constants [C.ATTR_vs_pos, C.ATTR_vs_color0, C.ATTR_vs_texcoord0] are generated bysokol-shdc @@ -493,7 +493,7 @@ fn my_init(mut app App) { // 3d pipeline mut pipdesc := gfx.PipelineDesc{} - unsafe { C.memset(&pipdesc, 0, sizeof(pipdesc)) } + unsafe { vmemset(&pipdesc, 0, int(sizeof(pipdesc))) } color_state := gfx.ColorState{ blend: gfx.BlendState{ diff --git a/examples/sokol/03_march_tracing_glsl/rt_glsl.v b/examples/sokol/03_march_tracing_glsl/rt_glsl.v index c1c7ce4458..876f9c625c 100644 --- a/examples/sokol/03_march_tracing_glsl/rt_glsl.v +++ b/examples/sokol/03_march_tracing_glsl/rt_glsl.v @@ -156,7 +156,7 @@ fn init_cube_glsl(mut app App) { ] mut vert_buffer_desc := gfx.BufferDesc{label: c'cube-vertices'} - unsafe { C.memset(&vert_buffer_desc, 0, sizeof(vert_buffer_desc)) } + unsafe { vmemset(&vert_buffer_desc, 0, int(sizeof(vert_buffer_desc))) } vert_buffer_desc.size = usize(vertices.len * int(sizeof(Vertex_t))) vert_buffer_desc.data = gfx.Range{ @@ -178,7 +178,7 @@ fn init_cube_glsl(mut app App) { ] mut index_buffer_desc := gfx.BufferDesc{label: c'cube-indices'} - unsafe {C.memset(&index_buffer_desc, 0, sizeof(index_buffer_desc))} + unsafe {vmemset(&index_buffer_desc, 0, int(sizeof(index_buffer_desc)))} index_buffer_desc.size = usize(indices.len * int(sizeof(u16))) index_buffer_desc.data = gfx.Range{ @@ -193,7 +193,7 @@ fn init_cube_glsl(mut app App) { shader := gfx.make_shader(C.rt_shader_desc(C.sg_query_backend())) mut pipdesc := gfx.PipelineDesc{} - unsafe { C.memset(&pipdesc, 0, sizeof(pipdesc)) } + unsafe { vmemset(&pipdesc, 0, int(sizeof(pipdesc))) } pipdesc.layout.buffers[0].stride = int(sizeof(Vertex_t)) // the constants [C.ATTR_vs_pos, C.ATTR_vs_color0, C.ATTR_vs_texcoord0] are generated by sokol-shdc diff --git a/examples/sokol/04_multi_shader_glsl/rt_glsl.v b/examples/sokol/04_multi_shader_glsl/rt_glsl.v index 94902c8d38..e4d507906f 100644 --- a/examples/sokol/04_multi_shader_glsl/rt_glsl.v +++ b/examples/sokol/04_multi_shader_glsl/rt_glsl.v @@ -158,7 +158,7 @@ fn init_cube_glsl_m(mut app App) { ] mut vert_buffer_desc := gfx.BufferDesc{label: c'cube-vertices'} - unsafe { C.memset(&vert_buffer_desc, 0, sizeof(vert_buffer_desc)) } + unsafe { vmemset(&vert_buffer_desc, 0, int(sizeof(vert_buffer_desc))) } vert_buffer_desc.size = usize(vertices.len * int(sizeof(Vertex_t))) vert_buffer_desc.data = gfx.Range{ ptr: vertices.data @@ -180,7 +180,7 @@ fn init_cube_glsl_m(mut app App) { ] mut index_buffer_desc := gfx.BufferDesc{label: c'cube-indices'} - unsafe { C.memset(&index_buffer_desc, 0, sizeof(index_buffer_desc)) } + unsafe { vmemset(&index_buffer_desc, 0, int(sizeof(index_buffer_desc))) } index_buffer_desc.size = usize(indices.len * int(sizeof(u16))) index_buffer_desc.data = gfx.Range{ ptr: indices.data @@ -193,7 +193,7 @@ fn init_cube_glsl_m(mut app App) { shader := gfx.make_shader(C.rt_march_shader_desc(C.sg_query_backend())) mut pipdesc := gfx.PipelineDesc{} - unsafe { C.memset(&pipdesc, 0, sizeof(pipdesc)) } + unsafe { vmemset(&pipdesc, 0, int(sizeof(pipdesc))) } pipdesc.layout.buffers[0].stride = int(sizeof(Vertex_t)) // the constants [C.ATTR_vs_m_pos, C.ATTR_vs_m_color0, C.ATTR_vs_m_texcoord0] are generated by sokol-shdc @@ -213,7 +213,7 @@ fn init_cube_glsl_m(mut app App) { pipdesc.label = 'glsl_shader pipeline'.str mut bind := gfx.Bindings{} - unsafe { C.memset(&bind, 0, sizeof(bind)) } + unsafe { vmemset(&bind, 0, int(sizeof(bind))) } bind.vertex_buffers[0] = vbuf bind.index_buffer = ibuf bind.fs_images[C.SLOT_tex] = app.texture @@ -264,7 +264,7 @@ fn init_cube_glsl_p(mut app App) { ] mut vert_buffer_desc := gfx.BufferDesc{label: c'cube-vertices'} - unsafe { C.memset(&vert_buffer_desc, 0, sizeof(vert_buffer_desc)) } + unsafe { vmemset(&vert_buffer_desc, 0, int(sizeof(vert_buffer_desc))) } vert_buffer_desc.size = usize(vertices.len * int(sizeof(Vertex_t))) vert_buffer_desc.data = gfx.Range{ ptr: vertices.data @@ -287,7 +287,7 @@ fn init_cube_glsl_p(mut app App) { ] mut index_buffer_desc := gfx.BufferDesc{label: c'cube-indices'} - unsafe { C.memset(&index_buffer_desc, 0, sizeof(index_buffer_desc)) } + unsafe { vmemset(&index_buffer_desc, 0, int(sizeof(index_buffer_desc))) } index_buffer_desc.size = usize(indices.len * int(sizeof(u16))) index_buffer_desc.data = gfx.Range{ ptr: indices.data @@ -300,7 +300,7 @@ fn init_cube_glsl_p(mut app App) { shader := gfx.make_shader(C.rt_puppy_shader_desc(C.sg_query_backend())) mut pipdesc := gfx.PipelineDesc{} - unsafe { C.memset(&pipdesc, 0, sizeof(pipdesc)) } + unsafe { vmemset(&pipdesc, 0, int(sizeof(pipdesc))) } pipdesc.layout.buffers[0].stride = int(sizeof(Vertex_t)) // the constants [C.ATTR_vs_p_pos, C.ATTR_vs_p_color0, C.ATTR_vs_p_texcoord0] are generated by sokol-shdc @@ -321,7 +321,7 @@ fn init_cube_glsl_p(mut app App) { pipdesc.label = 'glsl_shader pipeline'.str mut bind := gfx.Bindings{} - unsafe { C.memset(&bind, 0, sizeof(bind)) } + unsafe { vmemset(&bind, 0, int(sizeof(bind))) } bind.vertex_buffers[0] = vbuf bind.index_buffer = ibuf bind.fs_images[C.SLOT_tex] = app.texture diff --git a/examples/sokol/05_instancing_glsl/rt_glsl.v b/examples/sokol/05_instancing_glsl/rt_glsl.v index 0584dd2124..1885704f0d 100644 --- a/examples/sokol/05_instancing_glsl/rt_glsl.v +++ b/examples/sokol/05_instancing_glsl/rt_glsl.v @@ -173,7 +173,7 @@ fn init_cube_glsl_i(mut app App) { ] mut vert_buffer_desc := gfx.BufferDesc{label: c'cube-vertices'} - unsafe {C.memset(&vert_buffer_desc, 0, sizeof(vert_buffer_desc))} + unsafe {vmemset(&vert_buffer_desc, 0, int(sizeof(vert_buffer_desc)))} vert_buffer_desc.size = usize(vertices.len * int(sizeof(Vertex_t))) vert_buffer_desc.data = gfx.Range{ ptr: vertices.data @@ -184,7 +184,7 @@ fn init_cube_glsl_i(mut app App) { /* create an instance buffer for the cube */ mut inst_buffer_desc := gfx.BufferDesc{label: c'instance-data'} - unsafe {C.memset(&inst_buffer_desc, 0, sizeof(inst_buffer_desc))} + unsafe {vmemset(&inst_buffer_desc, 0, int(sizeof(inst_buffer_desc)))} inst_buffer_desc.size = usize(num_inst * int(sizeof(m4.Vec4))) inst_buffer_desc.@type = .vertexbuffer @@ -203,7 +203,7 @@ fn init_cube_glsl_i(mut app App) { ] mut index_buffer_desc := gfx.BufferDesc{label: c'cube-indices'} - unsafe {C.memset(&index_buffer_desc, 0, sizeof(index_buffer_desc))} + unsafe {vmemset(&index_buffer_desc, 0, int(sizeof(index_buffer_desc)))} index_buffer_desc.size = usize(indices.len * int(sizeof(u16))) index_buffer_desc.data = gfx.Range{ ptr: indices.data @@ -216,7 +216,7 @@ fn init_cube_glsl_i(mut app App) { shader := gfx.make_shader(C.instancing_shader_desc(C.sg_query_backend())) mut pipdesc := gfx.PipelineDesc{} - unsafe {C.memset(&pipdesc, 0, sizeof(pipdesc))} + unsafe {vmemset(&pipdesc, 0, int(sizeof(pipdesc)))} pipdesc.layout.buffers[0].stride = int(sizeof(Vertex_t)) // the constants [C.ATTR_vs_m_pos, C.ATTR_vs_m_color0, C.ATTR_vs_m_texcoord0] are generated by sokol-shdc @@ -246,7 +246,7 @@ fn init_cube_glsl_i(mut app App) { pipdesc.label = "glsl_shader pipeline".str mut bind := gfx.Bindings{} - unsafe {C.memset(&bind, 0, sizeof(bind))} + unsafe {vmemset(&bind, 0, int(sizeof(bind)))} bind.vertex_buffers[0] = vbuf // vertex buffer bind.vertex_buffers[1] = inst_buf // instance buffer bind.index_buffer = ibuf diff --git a/examples/sokol/06_obj_viewer/modules/obj/rend.v b/examples/sokol/06_obj_viewer/modules/obj/rend.v index ab6d9d4a83..2f3c51411b 100644 --- a/examples/sokol/06_obj_viewer/modules/obj/rend.v +++ b/examples/sokol/06_obj_viewer/modules/obj/rend.v @@ -71,7 +71,7 @@ pub fn (mut obj_part ObjPart) create_pipeline(in_part []int, shader gfx.Shader, mut vert_buffer_desc := gfx.BufferDesc{ label: 0 } - unsafe { C.memset(&vert_buffer_desc, 0, sizeof(vert_buffer_desc)) } + unsafe { vmemset(&vert_buffer_desc, 0, int(sizeof(vert_buffer_desc))) } vert_buffer_desc.size = usize(obj_buf.vbuf.len * int(sizeof(Vertex_pnct))) vert_buffer_desc.data = gfx.Range{ @@ -87,7 +87,7 @@ pub fn (mut obj_part ObjPart) create_pipeline(in_part []int, shader gfx.Shader, mut index_buffer_desc := gfx.BufferDesc{ label: 0 } - unsafe { C.memset(&index_buffer_desc, 0, sizeof(index_buffer_desc)) } + unsafe { vmemset(&index_buffer_desc, 0, int(sizeof(index_buffer_desc))) } index_buffer_desc.size = usize(obj_buf.ibuf.len * int(sizeof(u32))) index_buffer_desc.data = gfx.Range{ @@ -100,7 +100,7 @@ pub fn (mut obj_part ObjPart) create_pipeline(in_part []int, shader gfx.Shader, ibuf := gfx.make_buffer(&index_buffer_desc) mut pipdesc := gfx.PipelineDesc{} - unsafe { C.memset(&pipdesc, 0, sizeof(pipdesc)) } + unsafe { vmemset(&pipdesc, 0, int(sizeof(pipdesc))) } pipdesc.layout.buffers[0].stride = int(sizeof(Vertex_pnct)) // the constants [C.ATTR_vs_a_Position, C.ATTR_vs_a_Color, C.ATTR_vs_a_Texcoord0] are generated by sokol-shdc diff --git a/examples/sokol/particles/particles.v b/examples/sokol/particles/particles.v index e0e40c8c8d..75fad1a968 100644 --- a/examples/sokol/particles/particles.v +++ b/examples/sokol/particles/particles.v @@ -80,7 +80,7 @@ fn init(user_data voidptr) { } sgl.setup(&sgl_desc) mut pipdesc := gfx.PipelineDesc{} - unsafe { C.memset(&pipdesc, 0, sizeof(pipdesc)) } + unsafe { vmemset(&pipdesc, 0, int(sizeof(pipdesc))) } color_state := gfx.ColorState{ blend: gfx.BlendState{ diff --git a/examples/viewer/view.v b/examples/viewer/view.v index 39aca77a77..faa87c5368 100644 --- a/examples/viewer/view.v +++ b/examples/viewer/view.v @@ -316,7 +316,7 @@ fn app_init(mut app App) { // 3d pipeline mut pipdesc := gfx.PipelineDesc{} - unsafe { C.memset(&pipdesc, 0, sizeof(pipdesc)) } + unsafe { vmemset(&pipdesc, 0, int(sizeof(pipdesc))) } color_state := gfx.ColorState{ blend: gfx.BlendState{