render/d3d11: adjust allowed frame 'latency' (frames-in-queue) based on number of active windows, to not unnecessarily block if we have two windows to build frames for; demon/linux: sketch out register writing path, ensure reg read/write paths have slots for other architectures

This commit is contained in:
Ryan Fleury
2025-07-31 14:09:42 -07:00
parent ad735dab5e
commit 1a19bf9663
4 changed files with 203 additions and 156 deletions
+42 -1
View File
@@ -536,6 +536,17 @@ internal B32
dmn_lnx_thread_read_reg_block(DMN_LNX_Entity *thread, void *reg_block) dmn_lnx_thread_read_reg_block(DMN_LNX_Entity *thread, void *reg_block)
{ {
B32 result = 0; B32 result = 0;
switch(thread->arch)
{
case Arch_Null:
case Arch_COUNT:{}break;
case Arch_x86:
case Arch_arm64:
case Arch_arm32:
{NotImplemented;}break;
//- rjf: [x64]
case Arch_x64:
{ {
REGS_RegBlockX64 *dst = (REGS_RegBlockX64 *)reg_block; REGS_RegBlockX64 *dst = (REGS_RegBlockX64 *)reg_block;
pid_t tid = (pid_t)thread->id; pid_t tid = (pid_t)thread->id;
@@ -696,6 +707,29 @@ dmn_lnx_thread_read_reg_block(DMN_LNX_Entity *thread, void *reg_block)
} }
result = got_debug; result = got_debug;
}break;
}
return result;
}
internal B32
dmn_lnx_thread_write_reg_block(DMN_LNX_Entity *thread, void *reg_block)
{
B32 result = 0;
switch(thread->arch)
{
case Arch_Null:
case Arch_COUNT:{}break;
case Arch_x86:
case Arch_arm64:
case Arch_arm32:
{NotImplemented;}break;
//- rjf: [x64]
case Arch_x64:
{
}break;
} }
return result; return result;
} }
@@ -1226,6 +1260,7 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
e->kind = e_kind; e->kind = e_kind;
e->process = dmn_lnx_handle_from_entity(process); e->process = dmn_lnx_handle_from_entity(process);
e->thread = dmn_lnx_handle_from_entity(thread); e->thread = dmn_lnx_handle_from_entity(thread);
e->instruction_pointer = rip;
} }
//- rjf: WSTOPSIG(status) is SIGSTOP //- rjf: WSTOPSIG(status) is SIGSTOP
@@ -1473,7 +1508,13 @@ dmn_thread_read_reg_block(DMN_Handle handle, void *reg_block)
internal B32 internal B32
dmn_thread_write_reg_block(DMN_Handle handle, void *reg_block) dmn_thread_write_reg_block(DMN_Handle handle, void *reg_block)
{ {
return 0; B32 result = 0;
DMN_AccessScope
{
DMN_LNX_Entity *thread = dmn_lnx_entity_from_handle(handle);
result = dmn_lnx_thread_write_reg_block(thread, reg_block);
}
return result;
} }
//- rjf: system process listing //- rjf: system process listing
+1
View File
@@ -331,5 +331,6 @@ internal DMN_Handle dmn_lnx_handle_from_entity(DMN_LNX_Entity *entity);
internal DMN_LNX_Entity *dmn_lnx_entity_from_handle(DMN_Handle handle); internal DMN_LNX_Entity *dmn_lnx_entity_from_handle(DMN_Handle handle);
internal DMN_LNX_Entity *dmn_lnx_thread_from_pid(pid_t pid); internal DMN_LNX_Entity *dmn_lnx_thread_from_pid(pid_t pid);
internal B32 dmn_lnx_thread_read_reg_block(DMN_LNX_Entity *thread, void *reg_block); internal B32 dmn_lnx_thread_read_reg_block(DMN_LNX_Entity *thread, void *reg_block);
internal B32 dmn_lnx_thread_write_reg_block(DMN_LNX_Entity *thread, void *reg_block);
#endif // DEMON_CORE_LINUX_H #endif // DEMON_CORE_LINUX_H
+4
View File
@@ -548,6 +548,8 @@ r_window_equip(OS_Handle handle)
r_d3d11_state->device->lpVtbl->CreateRenderTargetView(r_d3d11_state->device, (ID3D11Resource *)window->framebuffer, &framebuffer_rtv_desc, &window->framebuffer_rtv); r_d3d11_state->device->lpVtbl->CreateRenderTargetView(r_d3d11_state->device, (ID3D11Resource *)window->framebuffer, &framebuffer_rtv_desc, &window->framebuffer_rtv);
result = r_d3d11_handle_from_window(window); result = r_d3d11_handle_from_window(window);
r_d3d11_state->window_count += 1;
r_d3d11_state->dxgi_device->lpVtbl->SetMaximumFrameLatency(r_d3d11_state->dxgi_device, Clamp(1, r_d3d11_state->window_count, 16));
} }
ProfEnd(); ProfEnd();
return result; return result;
@@ -571,6 +573,8 @@ r_window_unequip(OS_Handle handle, R_Handle equip_handle)
window->swapchain->lpVtbl->Release(window->swapchain); window->swapchain->lpVtbl->Release(window->swapchain);
window->generation += 1; window->generation += 1;
SLLStackPush(r_d3d11_state->first_free_window, window); SLLStackPush(r_d3d11_state->first_free_window, window);
r_d3d11_state->window_count -= 1;
r_d3d11_state->dxgi_device->lpVtbl->SetMaximumFrameLatency(r_d3d11_state->dxgi_device, Clamp(1, r_d3d11_state->window_count, 16));
} }
ProfEnd(); ProfEnd();
} }
+1
View File
@@ -129,6 +129,7 @@ struct R_D3D11_State
{ {
// rjf: state // rjf: state
Arena *arena; Arena *arena;
U64 window_count;
R_D3D11_Window *first_free_window; R_D3D11_Window *first_free_window;
R_D3D11_Tex2D *first_free_tex2d; R_D3D11_Tex2D *first_free_tex2d;
R_D3D11_Buffer *first_free_buffer; R_D3D11_Buffer *first_free_buffer;