1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: automatically move (some) referenced objects to heap (#9873)

This commit is contained in:
Uwe Krüger
2021-04-25 20:40:38 +02:00
committed by GitHub
parent 00261afbc1
commit 3c0a368af3
32 changed files with 264 additions and 51 deletions

View File

@@ -400,7 +400,7 @@ fn draw_cube_glsl(app App) {
0 /* padding 4 Bytes == 1 f32 */,
]!
fs_uniforms_range := C.sg_range{
ptr: &text_res
ptr: unsafe { &text_res }
size: size_t(4 * 4)
}
gfx.apply_uniforms(C.SG_SHADERSTAGE_FS, C.SLOT_fs_params, &fs_uniforms_range)

View File

@@ -302,7 +302,7 @@ fn draw_cube_glsl(app App) {
0 // padding bytes , see "fs_params" struct paddings in rt_glsl.h
]!
fs_uniforms_range := C.sg_range{
ptr: &tmp_fs_params
ptr: unsafe { &tmp_fs_params }
size: size_t(sizeof(tmp_fs_params))
}
gfx.apply_uniforms(C.SG_SHADERSTAGE_FS, C.SLOT_fs_params, &fs_uniforms_range)

View File

@@ -417,7 +417,7 @@ fn draw_cube_glsl_m(app App) {
0 // padding bytes , see "fs_params" struct paddings in rt_glsl.h
]!
fs_uniforms_range := C.sg_range{
ptr: &tmp_fs_params
ptr: unsafe { &tmp_fs_params }
size: size_t(sizeof(tmp_fs_params))
}
gfx.apply_uniforms(C.SG_SHADERSTAGE_FS, C.SLOT_fs_params_p, &fs_uniforms_range)
@@ -469,7 +469,7 @@ fn draw_cube_glsl_p(app App) {
0 // padding bytes , see "fs_params" struct paddings in rt_glsl.h
]!
fs_uniforms_range := C.sg_range{
ptr: &tmp_fs_params
ptr: unsafe { &tmp_fs_params }
size: size_t(sizeof(tmp_fs_params))
}
gfx.apply_uniforms(C.SG_SHADERSTAGE_FS, C.SLOT_fs_params_p, &fs_uniforms_range)

View File

@@ -331,7 +331,7 @@ fn draw_cube_glsl_i(mut app App){
app.inst_pos[index] = m4.Vec4{e:[f32((x - cx - app.camera_x) * cube_size),y ,f32( (z - cz - app.camera_z) * cube_size),spare_param]!}
}
range := C.sg_range{
ptr: &app.inst_pos
ptr: unsafe { &app.inst_pos }
size: size_t(num_inst * int(sizeof(m4.Vec4)))
}
gfx.update_buffer(app.bind['inst'].vertex_buffers[1], &range )
@@ -341,7 +341,7 @@ fn draw_cube_glsl_i(mut app App){
// passing the view matrix as uniform
// res is a 4x4 matrix of f32 thus: 4*16 byte of size
vs_uniforms_range := C.sg_range{
ptr: &tr_matrix
ptr: unsafe { &tr_matrix }
size: size_t(4 * 16)
}
gfx.apply_uniforms(C.SG_SHADERSTAGE_VS, C.SLOT_vs_params_i, &vs_uniforms_range)
@@ -359,7 +359,7 @@ fn draw_cube_glsl_i(mut app App){
0,0 // padding bytes , see "fs_params" struct paddings in rt_glsl.h
]!
fs_uniforms_range := C.sg_range{
ptr: &tmp_fs_params
ptr: unsafe { &tmp_fs_params }
size: size_t(sizeof(tmp_fs_params))
}
gfx.apply_uniforms(C.SG_SHADERSTAGE_FS, C.SLOT_fs_params, &fs_uniforms_range)

View File

@@ -235,7 +235,7 @@ pub fn (obj_part ObjPart) bind_and_draw(rend_data_index int, in_data Shader_data
size: size_t(in_data.vs_len)
}
fs_uniforms_range := C.sg_range{
ptr: &tmp_fs_params
ptr: unsafe { &tmp_fs_params }
size: size_t(in_data.fs_len)
}

View File

@@ -153,9 +153,9 @@ fn draw_model(app App, model_pos m4.Vec4) u32 {
tmp_fs_params.ligth = m4.vec3(x_light, radius_light, z_light)
sd := obj.Shader_data{
vs_data: &tmp_vs_param
vs_data: unsafe { &tmp_vs_param }
vs_len: int(sizeof(tmp_vs_param))
fs_data: &tmp_fs_params
fs_data: unsafe { &tmp_fs_params }
fs_len: int(sizeof(tmp_fs_params))
}