remove ui gpu double buffering
This commit is contained in:
parent
1397c4a7a4
commit
83cecf39f0
@ -553,13 +553,13 @@ UI_Frame *UI_BeginFrame(UI_FrameFlag frame_flags)
|
|||||||
if (!UI.box_arena)
|
if (!UI.box_arena)
|
||||||
{
|
{
|
||||||
UI.box_arena = AcquireArena(Gibi(64));
|
UI.box_arena = AcquireArena(Gibi(64));
|
||||||
|
UI.gpu_frame_arena = G_AcquireArena();
|
||||||
// Init frames
|
// Init frames
|
||||||
for (u64 i = 0; i < countof(UI.frames); ++i)
|
for (u64 i = 0; i < countof(UI.frames); ++i)
|
||||||
{
|
{
|
||||||
UI_Frame *frame = &UI.frames[i];
|
UI_Frame *frame = &UI.frames[i];
|
||||||
frame->arena = AcquireArena(Gibi(64));
|
frame->arena = AcquireArena(Gibi(64));
|
||||||
frame->rects_arena = AcquireArena(Gibi(64));
|
frame->rects_arena = AcquireArena(Gibi(64));
|
||||||
frame->gpu_arena = G_AcquireArena();
|
|
||||||
}
|
}
|
||||||
// Init root box
|
// Init root box
|
||||||
{
|
{
|
||||||
@ -584,17 +584,15 @@ UI_Frame *UI_BeginFrame(UI_FrameFlag frame_flags)
|
|||||||
{
|
{
|
||||||
Arena *old_arena = frame->arena;
|
Arena *old_arena = frame->arena;
|
||||||
Arena *old_rects_arena = frame->rects_arena;
|
Arena *old_rects_arena = frame->rects_arena;
|
||||||
G_ArenaHandle old_gpu_arena = frame->gpu_arena;
|
|
||||||
ZeroStruct(frame);
|
ZeroStruct(frame);
|
||||||
frame->arena = old_arena;
|
frame->arena = old_arena;
|
||||||
frame->rects_arena = old_rects_arena;
|
frame->rects_arena = old_rects_arena;
|
||||||
frame->gpu_arena = old_gpu_arena;
|
|
||||||
}
|
}
|
||||||
frame->window_frame = WND_BeginFrame(G_Format_R16G16B16A16_Float, WND_BackbufferSizeMode_MatchMonitor);
|
frame->window_frame = WND_BeginFrame(G_Format_R16G16B16A16_Float, WND_BackbufferSizeMode_MatchMonitor);
|
||||||
frame->cl = G_PrepareCommandList(G_QueueKind_Direct);
|
frame->cl = G_PrepareCommandList(G_QueueKind_Direct);
|
||||||
ResetArena(frame->arena);
|
ResetArena(frame->arena);
|
||||||
ResetArena(frame->rects_arena);
|
ResetArena(frame->rects_arena);
|
||||||
G_ResetArena(frame->cl, frame->gpu_arena);
|
G_ResetArena(frame->cl, UI.gpu_frame_arena);
|
||||||
|
|
||||||
{
|
{
|
||||||
i64 now_ns = TimeNs();
|
i64 now_ns = TimeNs();
|
||||||
@ -1700,23 +1698,23 @@ void UI_EndFrame(UI_Frame *frame, i32 vsync)
|
|||||||
|
|
||||||
// Target
|
// Target
|
||||||
G_ResourceHandle draw_target = G_PushTexture2D(
|
G_ResourceHandle draw_target = G_PushTexture2D(
|
||||||
frame->gpu_arena, frame->cl,
|
UI.gpu_frame_arena, frame->cl,
|
||||||
G_Format_R16G16B16A16_Float,
|
G_Format_R16G16B16A16_Float,
|
||||||
monitor_size,
|
monitor_size,
|
||||||
G_Layout_DirectQueue_RenderTarget,
|
G_Layout_DirectQueue_RenderTarget,
|
||||||
.flags = G_ResourceFlag_AllowRenderTarget,
|
.flags = G_ResourceFlag_AllowRenderTarget,
|
||||||
.name = Lit("UI draw target")
|
.name = Lit("UI draw target")
|
||||||
);
|
);
|
||||||
G_Texture2DRef draw_target_ro = G_PushTexture2DRef(frame->gpu_arena, draw_target);
|
G_Texture2DRef draw_target_ro = G_PushTexture2DRef(UI.gpu_frame_arena, draw_target);
|
||||||
|
|
||||||
// Rects
|
// Rects
|
||||||
u64 rects_count = ArenaCount(frame->rects_arena, UI_GpuRect);
|
u64 rects_count = ArenaCount(frame->rects_arena, UI_GpuRect);
|
||||||
G_ResourceHandle rects_buff = G_PushBufferFromCpuCopy(
|
G_ResourceHandle rects_buff = G_PushBufferFromCpuCopy(
|
||||||
frame->gpu_arena, frame->cl,
|
UI.gpu_frame_arena, frame->cl,
|
||||||
StringFromArena(frame->rects_arena),
|
StringFromArena(frame->rects_arena),
|
||||||
.name = Lit("UI rects")
|
.name = Lit("UI rects")
|
||||||
);
|
);
|
||||||
G_StructuredBufferRef rects_ro = G_PushStructuredBufferRef(frame->gpu_arena, rects_buff, UI_GpuRect);
|
G_StructuredBufferRef rects_ro = G_PushStructuredBufferRef(UI.gpu_frame_arena, rects_buff, UI_GpuRect);
|
||||||
|
|
||||||
// Params
|
// Params
|
||||||
UI_GpuParams params = Zi;
|
UI_GpuParams params = Zi;
|
||||||
@ -1729,11 +1727,11 @@ void UI_EndFrame(UI_Frame *frame, i32 vsync)
|
|||||||
params.aa = TweakFloat("UI anti-aliasing", 1, 0, 1);
|
params.aa = TweakFloat("UI anti-aliasing", 1, 0, 1);
|
||||||
}
|
}
|
||||||
G_ResourceHandle params_buff = G_PushBufferFromCpuCopy(
|
G_ResourceHandle params_buff = G_PushBufferFromCpuCopy(
|
||||||
frame->gpu_arena, frame->cl,
|
UI.gpu_frame_arena, frame->cl,
|
||||||
StringFromStruct(¶ms),
|
StringFromStruct(¶ms),
|
||||||
.name = Lit("UI gpu params")
|
.name = Lit("UI gpu params")
|
||||||
);
|
);
|
||||||
G_StructuredBufferRef params_ro = G_PushStructuredBufferRef(frame->gpu_arena, params_buff, UI_GpuParams);
|
G_StructuredBufferRef params_ro = G_PushStructuredBufferRef(UI.gpu_frame_arena, params_buff, UI_GpuParams);
|
||||||
|
|
||||||
// Initial constants
|
// Initial constants
|
||||||
G_SetConstant(frame->cl, UI_GpuConst_Params, params_ro);
|
G_SetConstant(frame->cl, UI_GpuConst_Params, params_ro);
|
||||||
|
|||||||
@ -377,7 +377,6 @@ Struct(UI_Frame)
|
|||||||
{
|
{
|
||||||
Arena *arena;
|
Arena *arena;
|
||||||
Arena *rects_arena;
|
Arena *rects_arena;
|
||||||
G_ArenaHandle gpu_arena;
|
|
||||||
|
|
||||||
WND_Frame window_frame;
|
WND_Frame window_frame;
|
||||||
G_ResourceHandle backbuffer;
|
G_ResourceHandle backbuffer;
|
||||||
@ -423,6 +422,8 @@ Struct(UI_Ctx)
|
|||||||
|
|
||||||
i64 current_frame_tick;
|
i64 current_frame_tick;
|
||||||
UI_Frame frames[2];
|
UI_Frame frames[2];
|
||||||
|
|
||||||
|
G_ArenaHandle gpu_frame_arena;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern UI_Ctx UI;
|
extern UI_Ctx UI;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user