Skip to content

Commit 0ffc33a

Browse files
committed
examples, gg, gg.m4: fix VFLAGS='-no-skip-unused -cstrict -cc clang-18' v should-compile-all examples/sokol/ too
1 parent 3a331e0 commit 0ffc33a

File tree

9 files changed

+73
-76
lines changed

9 files changed

+73
-76
lines changed

examples/sokol/01_cubes/cube.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn create_texture(w int, h int, buf &u8) (gfx.Image, gfx.Sampler) {
3737
height: h
3838
num_mipmaps: 0
3939
// usage: .dynamic
40-
label: &u8(0)
40+
label: &char(0)
4141
d3d11_texture: 0
4242
}
4343
// comment, if .dynamic is enabled

examples/sokol/02_cubes_glsl/cube_glsl.v

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn create_texture(w int, h int, buf &u8) (gfx.Image, gfx.Sampler) {
6060
height: h
6161
num_mipmaps: 0
6262
// usage: .dynamic
63-
label: &u8(0)
63+
label: &char(0)
6464
d3d11_texture: 0
6565
}
6666
// comment if .dynamic is enabled
@@ -339,7 +339,7 @@ fn init_cube_glsl(mut app App) {
339339
ibuf := gfx.make_buffer(&index_buffer_desc)
340340

341341
// create shader
342-
shader := gfx.make_shader(C.cube_shader_desc(C.sg_query_backend()))
342+
shader := gfx.make_shader(voidptr(C.cube_shader_desc(C.sg_query_backend())))
343343

344344
mut pipdesc := gfx.PipelineDesc{}
345345
unsafe { vmemset(&pipdesc, 0, int(sizeof(pipdesc))) }
@@ -360,7 +360,7 @@ fn init_cube_glsl(mut app App) {
360360
}
361361
pipdesc.cull_mode = .back
362362

363-
pipdesc.label = 'glsl_shader pipeline'.str
363+
pipdesc.label = c'glsl_shader pipeline'
364364

365365
app.cube_bind.vertex_buffers[0] = vbuf
366366
app.cube_bind.index_buffer = ibuf

examples/sokol/03_march_tracing_glsl/rt_glsl.v

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn create_texture(w int, h int, buf &u8) (gfx.Image, gfx.Sampler) {
6363
// usage: .dynamic
6464
// wrap_u: .clamp_to_edge
6565
// wrap_v: .clamp_to_edge
66-
label: &u8(0)
66+
label: &char(0)
6767
d3d11_texture: 0
6868
}
6969
// comment if .dynamic is enabled
@@ -205,7 +205,7 @@ fn init_cube_glsl(mut app App) {
205205
ibuf := gfx.make_buffer(&index_buffer_desc)
206206

207207
// create shader
208-
shader := gfx.make_shader(C.rt_shader_desc(C.sg_query_backend()))
208+
shader := gfx.make_shader(voidptr(C.rt_shader_desc(C.sg_query_backend())))
209209

210210
mut pipdesc := gfx.PipelineDesc{}
211211
unsafe { vmemset(&pipdesc, 0, int(sizeof(pipdesc))) }
@@ -226,7 +226,7 @@ fn init_cube_glsl(mut app App) {
226226
}
227227
pipdesc.cull_mode = .back
228228

229-
pipdesc.label = 'glsl_shader pipeline'.str
229+
pipdesc.label = c'glsl_shader pipeline'
230230

231231
app.cube_bind.vertex_buffers[0] = vbuf
232232
app.cube_bind.index_buffer = ibuf

examples/sokol/04_multi_shader_glsl/rt_glsl.v

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,12 @@ fn (mut app App) on_init() {
285285
app.texture, app.sampler = create_texture(w, h, tmp_txt)
286286

287287
// vfmt off
288-
app.init_glsl_shader('march', C.rt_march_shader_desc(C.sg_query_backend()), [
288+
app.init_glsl_shader('march', voidptr(C.rt_march_shader_desc(C.sg_query_backend())), [
289289
u16(0), 1, 2, 0, 2, 3,
290290
6, 5, 4, 7, 6, 4,
291291
8, 9, 10, 8, 10, 11,
292292
])
293-
app.init_glsl_shader('puppy', C.rt_puppy_shader_desc(C.sg_query_backend()), [
293+
app.init_glsl_shader('puppy', voidptr(C.rt_puppy_shader_desc(C.sg_query_backend())), [
294294
u16(14), 13, 12, 15, 14, 12,
295295
16, 17, 18, 16, 18, 19,
296296
22, 21, 20, 23, 22, 20,

examples/sokol/05_instancing_glsl/rt_glsl.v

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fn create_texture(w int, h int, buf byteptr) (gfx.Image, gfx.Sampler) {
7474
//usage: .dynamic
7575
// wrap_u: .clamp_to_edge
7676
// wrap_v: .clamp_to_edge
77-
label: &u8(0)
77+
label: &char(0)
7878
d3d11_texture: 0
7979
}
8080
// vfmt on
@@ -225,7 +225,7 @@ fn init_cube_glsl_i(mut app App) {
225225
ibuf := gfx.make_buffer(&index_buffer_desc)
226226

227227
// create shader
228-
shader := gfx.make_shader(C.instancing_shader_desc(C.sg_query_backend()))
228+
shader := gfx.make_shader(voidptr(C.instancing_shader_desc(C.sg_query_backend())))
229229

230230
mut pipdesc := gfx.PipelineDesc{}
231231
unsafe { vmemset(&pipdesc, 0, int(sizeof(pipdesc))) }
@@ -257,7 +257,7 @@ fn init_cube_glsl_i(mut app App) {
257257
}
258258
pipdesc.cull_mode = .back
259259

260-
pipdesc.label = 'glsl_shader pipeline'.str
260+
pipdesc.label = c'glsl_shader pipeline'
261261

262262
mut bind := gfx.Bindings{}
263263
unsafe { vmemset(&bind, 0, int(sizeof(bind))) }

examples/sokol/06_obj_viewer/modules/obj/rend.v

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn create_texture(w int, h int, buf &u8) (gfx.Image, gfx.Sampler) {
2929
// usage: .dynamic
3030
// wrap_u: .clamp_to_edge
3131
// wrap_v: .clamp_to_edge
32-
label: &u8(0)
32+
label: &char(0)
3333
d3d11_texture: 0
3434
}
3535
// comment if .dynamic is enabled
@@ -87,7 +87,7 @@ pub fn (mut obj_part ObjPart) create_pipeline(in_part []int, shader gfx.Shader,
8787
}
8888

8989
vert_buffer_desc.type = .vertexbuffer
90-
vert_buffer_desc.label = 'vertbuf_part_${in_part:03}'.str
90+
vert_buffer_desc.label = &char('vertbuf_part_${in_part:03}'.str)
9191
vbuf := gfx.make_buffer(&vert_buffer_desc)
9292

9393
// index buffer
@@ -101,7 +101,7 @@ pub fn (mut obj_part ObjPart) create_pipeline(in_part []int, shader gfx.Shader,
101101
}
102102

103103
index_buffer_desc.type = .indexbuffer
104-
index_buffer_desc.label = 'indbuf_part_${in_part:03}'.str
104+
index_buffer_desc.label = &char('indbuf_part_${in_part:03}'.str)
105105
ibuf := gfx.make_buffer(&index_buffer_desc)
106106

107107
mut pipdesc := gfx.PipelineDesc{}
@@ -131,7 +131,7 @@ pub fn (mut obj_part ObjPart) create_pipeline(in_part []int, shader gfx.Shader,
131131
}
132132
pipdesc.cull_mode = .front
133133

134-
pipdesc.label = 'pip_part_${in_part:03}'.str
134+
pipdesc.label = &char('pip_part_${in_part:03}'.str)
135135

136136
// shader
137137
pipdesc.shader = shader
@@ -153,7 +153,7 @@ pub fn (mut obj_part ObjPart) create_pipeline(in_part []int, shader gfx.Shader,
153153
pub fn (mut obj_part ObjPart) init_render_data(texture gfx.Image, sampler gfx.Sampler) {
154154
// create shader
155155
// One shader for all the model
156-
shader := gfx.make_shader(C.gouraud_shader_desc(gfx.query_backend()))
156+
shader := gfx.make_shader(voidptr(C.gouraud_shader_desc(gfx.query_backend())))
157157

158158
mut part_dict := map[string][]int{}
159159
for i, p in obj_part.part {

examples/sokol/08_sdf/sdf.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn init(mut state State) {
3333

3434
mut pipeline := gfx.PipelineDesc{}
3535
pipeline.layout.attrs[C.ATTR_vs_position].format = .float2
36-
pipeline.shader = gfx.make_shader(C.sdf_shader_desc(gfx.query_backend()))
36+
pipeline.shader = gfx.make_shader(voidptr(C.sdf_shader_desc(gfx.query_backend())))
3737
state.pip = gfx.make_pipeline(&pipeline)
3838

3939
// No need to clear the window, since the shader will overwrite the whole framebuffer

vlib/gg/gg.c.v

+4-3
Original file line numberDiff line numberDiff line change
@@ -799,16 +799,17 @@ pub fn screen_size() Size {
799799
if output_info == unsafe { nil } {
800800
return Size{}
801801
}
802-
defer { C.XRRFreeOutputInfo(output_info) }
803802
crtc_info := C.XRRGetCrtcInfo(display, resources, output_info.crtc)
803+
C.XRRFreeOutputInfo(output_info)
804804
if crtc_info == unsafe { nil } {
805805
return Size{}
806806
}
807-
defer { C.XRRFreeCrtcInfo(crtc_info) }
808-
return Size{
807+
res := Size{
809808
width: unsafe { int(crtc_info.width) }
810809
height: unsafe { int(crtc_info.height) }
811810
}
811+
C.XRRFreeCrtcInfo(crtc_info)
812+
return res
812813
}
813814
}
814815
}

0 commit comments

Comments
 (0)