formatting

This commit is contained in:
jacob 2025-07-23 18:12:41 -05:00
parent 87b6e3b909
commit d427bcbb2a
3 changed files with 11 additions and 13 deletions

View File

@ -148,7 +148,7 @@ void gp_swapchain_wait(struct gp_swapchain *gp_swapchain);
* ========================== */ * ========================== */
/* 1. Clears the backbuffer and ensures it's at size `backbuffer_resolution` /* 1. Clears the backbuffer and ensures it's at size `backbuffer_resolution`
* 2. Blits `texture` to the backbuffer using `texture_xf` (applied to centered unit square) * 2. Blits `texture` to the backbuffer using `texture_xf`
* 3. Presents the backbuffer */ * 3. Presents the backbuffer */
void gp_present(struct gp_swapchain *gp_swapchain, struct v2i32 backbuffer_resolution, struct gp_resource *texture, struct xform texture_xf, i32 vsync); void gp_present(struct gp_swapchain *gp_swapchain, struct v2i32 backbuffer_resolution, struct gp_resource *texture, struct xform texture_xf, i32 vsync);

View File

@ -3004,24 +3004,15 @@ struct gp_resource *gp_run_render(struct gp_render_sig *render_sig, struct gp_re
__profn("Run render"); __profn("Run render");
__profnc_dx12(cl->cq->prof, cl->cl, "Run render", RGB32_F(0.5, 0.2, 0.2)); __profnc_dx12(cl->cq->prof, cl->cl, "Run render", RGB32_F(0.5, 0.2, 0.2));
struct mat4x4 world_to_render_vp_matrix = calculate_vp(world_to_render_xf, render_viewport.width, render_viewport.height); struct mat4x4 world_to_render_vp_matrix = calculate_vp(world_to_render_xf, render_viewport.width, render_viewport.height);
struct mat4x4 ui_vp_matrix = calculate_vp(XFORM_IDENT, ui_viewport.width, ui_viewport.height);
struct mat4x4 blit_vp_matrix = ZI; struct mat4x4 blit_vp_matrix = ZI;
{ {
#if 1
struct xform xf = render_to_ui_xf; struct xform xf = render_to_ui_xf;
//xf = xform_scaled(xf, V2(ui_size.x, ui_size.y));
xf = xform_scaled(xf, V2(render_size.x, render_size.y)); xf = xform_scaled(xf, V2(render_size.x, render_size.y));
xf = xform_translated(xf, V2(0.5, 0.5)); xf = xform_translated(xf, V2(0.5, 0.5));
blit_vp_matrix = calculate_vp(xf, ui_viewport.width, ui_viewport.height); blit_vp_matrix = calculate_vp(xf, ui_viewport.width, ui_viewport.height);
#else
struct mat4x4 blit_vp_matrix = calculate_vp(XFORM_TRS(.t = v2_mul(V2(ui_size.x, ui_size.y), 0.5), .s = V2(ui_size.x, ui_size.y)), ui_viewport.width, ui_viewport.height);
#endif
} }
struct mat4x4 ui_vp_matrix = calculate_vp(XFORM_IDENT, ui_viewport.width, ui_viewport.height);
/* Upload dummmy vert & index buffer */ /* Upload dummmy vert & index buffer */
/* TODO: Make these static */ /* TODO: Make these static */
/* Dummy vertex buffer */ /* Dummy vertex buffer */
@ -3674,7 +3665,14 @@ INTERNAL void present_blit(struct swapchain_buffer *dst, struct dx12_resource *s
struct rect viewport_rect = RECT_FROM_V2(V2(0, 0), V2(swapchain->resolution.x, swapchain->resolution.y)); struct rect viewport_rect = RECT_FROM_V2(V2(0, 0), V2(swapchain->resolution.x, swapchain->resolution.y));
D3D12_VIEWPORT viewport = viewport_from_rect(viewport_rect); D3D12_VIEWPORT viewport = viewport_from_rect(viewport_rect);
D3D12_RECT scissor = scissor_from_rect(viewport_rect); D3D12_RECT scissor = scissor_from_rect(viewport_rect);
struct mat4x4 vp_matrix = calculate_vp(src_xf, viewport.Width, viewport.Height);
struct mat4x4 vp_matrix = ZI;
{
struct xform xf = src_xf;
xf = xform_scaled(xf, V2(src->texture_size.x, src->texture_size.y));
xf = xform_translated(xf, V2(0.5, 0.5));
vp_matrix = calculate_vp(xf, viewport.Width, viewport.Height);
}
/* Transition dst to render target */ /* Transition dst to render target */
{ {

View File

@ -2083,7 +2083,7 @@ INTERNAL void user_update(struct sys_window *window)
} }
/* Present */ /* Present */
gp_present(G.swapchain, backbuffer_resolution, render_texture, XFORM_TRS(.t = v2_mul(G.screen_size, 0.5), .s = G.ui_size), VSYNC); gp_present(G.swapchain, backbuffer_resolution, render_texture, G.ui_to_screen_xf, VSYNC);
} }
/* ========================== * /* ========================== *