File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ pub fn build(b: *std.Build) void {
50
50
"use_wchar32" ,
51
51
"Extended unicode support" ,
52
52
) orelse false ,
53
+ .use_32bit_draw_idx = b .option (
54
+ bool ,
55
+ "use_32bit_draw_idx" ,
56
+ "Use 32-bit draw index" ,
57
+ ) orelse false ,
53
58
};
54
59
55
60
const options_step = b .addOptions ();
@@ -66,7 +71,12 @@ pub fn build(b: *std.Build) void {
66
71
},
67
72
});
68
73
69
- const cflags = &.{ "-fno-sanitize=undefined" , "-Wno-elaborated-enum-base" , "-Wno-error=date-time" };
74
+ const cflags = &.{
75
+ "-fno-sanitize=undefined" ,
76
+ "-Wno-elaborated-enum-base" ,
77
+ "-Wno-error=date-time" ,
78
+ if (options .use_32bit_draw_idx ) "-DIMGUI_USE_32BIT_DRAW_INDEX" else "" ,
79
+ };
70
80
71
81
const imgui = if (options .shared ) blk : {
72
82
const lib = b .addSharedLibrary (.{
Original file line number Diff line number Diff line change 111
111
// Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices).
112
112
// Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer.
113
113
// Read about ImGuiBackendFlags_RendererHasVtxOffset for details.
114
- // #define ImDrawIdx unsigned int
114
+ #ifdef IMGUI_USE_32BIT_DRAW_INDEX
115
+ #define ImDrawIdx unsigned int
116
+ #endif
115
117
116
118
// ---- Override ImDrawCallback signature (will need to modify renderer backends accordingly)
117
119
// struct ImDrawList;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ const assert = std.debug.assert;
25
25
pub const f32_min : f32 = 1.17549435082228750796873653722225e-38 ;
26
26
pub const f32_max : f32 = 3.40282346638528859811704183484517e+38 ;
27
27
//--------------------------------------------------------------------------------------------------
28
- pub const DrawIdx = u16 ;
28
+ pub const DrawIdx = if ( @import ( "zgui_options" ). use_32bit_draw_idx ) u32 else u16 ;
29
29
pub const DrawVert = extern struct {
30
30
pos : [2 ]f32 ,
31
31
uv : [2 ]f32 ,
You can’t perform that action at this time.
0 commit comments