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 {
5050 "use_wchar32" ,
5151 "Extended unicode support" ,
5252 ) 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 ,
5358 };
5459
5560 const options_step = b .addOptions ();
@@ -66,7 +71,12 @@ pub fn build(b: *std.Build) void {
6671 },
6772 });
6873
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+ };
7080
7181 const imgui = if (options .shared ) blk : {
7282 const lib = b .addSharedLibrary (.{
Original file line number Diff line number Diff line change 111111// Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices).
112112// Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer.
113113// 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
115117
116118// ---- Override ImDrawCallback signature (will need to modify renderer backends accordingly)
117119// struct ImDrawList;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ const assert = std.debug.assert;
2525pub const f32_min : f32 = 1.17549435082228750796873653722225e-38 ;
2626pub const f32_max : f32 = 3.40282346638528859811704183484517e+38 ;
2727//--------------------------------------------------------------------------------------------------
28- pub const DrawIdx = u16 ;
28+ pub const DrawIdx = if ( @import ( "zgui_options" ). use_32bit_draw_idx ) u32 else u16 ;
2929pub const DrawVert = extern struct {
3030 pos : [2 ]f32 ,
3131 uv : [2 ]f32 ,
You can’t perform that action at this time.
0 commit comments