fmt: fix alignment of struct init fields (#22025)

This commit is contained in:
yuyi 2024-08-11 14:11:24 +08:00 committed by GitHub
parent 99da5726db
commit c51d30bf53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
671 changed files with 18817 additions and 18787 deletions

View file

@ -56,16 +56,16 @@ mut:
fn create_texture(w int, h int, buf &u8) (gfx.Image, gfx.Sampler) {
sz := w * h * 4
mut img_desc := gfx.ImageDesc{
width: w
height: h
width: w
height: h
num_mipmaps: 0
// usage: .dynamic
label: &u8(0)
label: &u8(0)
d3d11_texture: 0
}
// comment if .dynamic is enabled
img_desc.data.subimage[0][0] = gfx.Range{
ptr: buf
ptr: buf
size: usize(sz)
}
@ -74,8 +74,8 @@ fn create_texture(w int, h int, buf &u8) (gfx.Image, gfx.Sampler) {
mut smp_desc := gfx.SamplerDesc{
min_filter: .linear
mag_filter: .linear
wrap_u: .clamp_to_edge
wrap_v: .clamp_to_edge
wrap_u: .clamp_to_edge
wrap_v: .clamp_to_edge
}
sg_smp := gfx.make_sampler(&smp_desc)
@ -91,7 +91,7 @@ fn update_text_texture(sg_img gfx.Image, w int, h int, buf &u8) {
sz := w * h * 4
mut tmp_sbc := gfx.ImageData{}
tmp_sbc.subimage[0][0] = gfx.Range{
ptr: buf
ptr: buf
size: usize(sz)
}
gfx.update_image(sg_img, &tmp_sbc)
@ -304,7 +304,7 @@ fn init_cube_glsl(mut app App) {
vert_buffer_desc.size = usize(vertices.len * int(sizeof(Vertex_t)))
vert_buffer_desc.data = gfx.Range{
ptr: vertices.data
ptr: vertices.data
size: usize(vertices.len * int(sizeof(Vertex_t)))
}
@ -331,7 +331,7 @@ fn init_cube_glsl(mut app App) {
index_buffer_desc.size = usize(indices.len * int(sizeof(u16)))
index_buffer_desc.data = gfx.Range{
ptr: indices.data
ptr: indices.data
size: usize(indices.len * int(sizeof(u16)))
}
@ -356,7 +356,7 @@ fn init_cube_glsl(mut app App) {
pipdesc.depth = gfx.DepthState{
write_enabled: true
compare: .less_equal
compare: .less_equal
}
pipdesc.cull_mode = .back
@ -407,7 +407,7 @@ fn draw_cube_glsl(app App) {
// passing the view matrix as uniform
// res is a 4x4 matrix of f32 thus: 4*16 byte of size
vs_uniforms_range := gfx.Range{
ptr: &tr_matrix
ptr: &tr_matrix
size: usize(4 * 16)
}
gfx.apply_uniforms(.vs, C.SLOT_vs_params, &vs_uniforms_range)
@ -421,7 +421,7 @@ fn draw_cube_glsl(app App) {
0, // padding 4 Bytes == 1 f32
]!
fs_uniforms_range := gfx.Range{
ptr: unsafe { &text_res }
ptr: unsafe { &text_res }
size: usize(4 * 4)
}
gfx.apply_uniforms(.fs, C.SLOT_fs_params, &fs_uniforms_range)
@ -528,7 +528,7 @@ fn my_init(mut app App) {
color_state := gfx.ColorTargetState{
blend: gfx.BlendState{
enabled: true
enabled: true
src_factor_rgb: .src_alpha
dst_factor_rgb: .one_minus_src_alpha
}
@ -537,7 +537,7 @@ fn my_init(mut app App) {
pipdesc.depth = gfx.DepthState{
write_enabled: true
compare: .less_equal
compare: .less_equal
}
pipdesc.cull_mode = .back
@ -610,15 +610,15 @@ fn main() {
println(a)
app.gg = gg.new_context(
width: win_width
height: win_height
width: win_width
height: win_height
create_window: true
window_title: '3D Cube Demo'
user_data: app
bg_color: bg_color
frame_fn: frame
init_fn: my_init
event_fn: my_event_manager
window_title: '3D Cube Demo'
user_data: app
bg_color: bg_color
frame_fn: frame
init_fn: my_init
event_fn: my_event_manager
)
app.ticks = time.ticks()