use standard indentation style for multi-line function parameters

This commit is contained in:
jacob 2025-12-18 16:48:41 -06:00
parent 83f7c48369
commit c1b768282f
14 changed files with 195 additions and 143 deletions

View File

@ -275,13 +275,15 @@ void W32_BootstrapLogs(String logfile_path)
TempArena scratch = BeginScratchNoConflict(); TempArena scratch = BeginScratchNoConflict();
{ {
wchar_t *path_wstr = WstrFromString(scratch.arena, logfile_path); wchar_t *path_wstr = WstrFromString(scratch.arena, logfile_path);
W32.logfile = CreateFileW(path_wstr, W32.logfile = CreateFileW(
FILE_APPEND_DATA, path_wstr,
FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_APPEND_DATA,
0, FILE_SHARE_READ | FILE_SHARE_WRITE,
CREATE_ALWAYS, 0,
FILE_ATTRIBUTE_NORMAL, CREATE_ALWAYS,
0); FILE_ATTRIBUTE_NORMAL,
0
);
} }
EndScratch(scratch); EndScratch(scratch);
} }

View File

@ -63,7 +63,7 @@ Struct(G_QueueBarrierDesc)
/* NOTE: Matches DirectX DXGI_FORMAT */ /* NOTE: Matches DirectX DXGI_FORMAT */
Enum(G_Format) Enum(G_Format)
{ {
G_Format_Unknown = 0, G_Format_Unknown = 0,
G_Format_R32G32B32A32_Typeless = 1, G_Format_R32G32B32A32_Typeless = 1,
G_Format_R32G32B32A32_Float = 2, G_Format_R32G32B32A32_Float = 2,
G_Format_R32G32B32A32_Uint = 3, G_Format_R32G32B32A32_Uint = 3,
@ -742,12 +742,14 @@ void G_Compute(G_CommandListHandle cl, ComputeShader cs, Vec3I32 groups);
//- Rasterize //- Rasterize
void G_Rasterize(G_CommandListHandle cl, void G_Rasterize(
VertexShader vs, PixelShader ps, G_CommandListHandle cl,
u32 instances_count, G_IndexBufferDesc index_buffer, VertexShader vs, PixelShader ps,
u32 render_targets_count, G_ResourceHandle *render_targets, u32 instances_count, G_IndexBufferDesc index_buffer,
Rng3 viewport, Rng2 scissor, u32 render_targets_count, G_ResourceHandle *render_targets,
G_RasterMode mode); Rng3 viewport, Rng2 scissor,
G_RasterMode mode
);
//- Clear //- Clear

View File

@ -106,9 +106,11 @@ void G_Bootstrap(void)
{ {
if (first_gpu_name.len > 0) if (first_gpu_name.len > 0)
{ {
error = StringF(scratch.arena, error = StringF(
"Could not initialize device '%F' with D3D_FEATURE_LEVEL_12_0. Ensure that the device is capable and drivers are up to date.", scratch.arena,
FmtString(first_gpu_name)); "Could not initialize device '%F' with D3D_FEATURE_LEVEL_12_0. Ensure that the device is capable and drivers are up to date.",
FmtString(first_gpu_name)
);
} }
Panic(error); Panic(error);
} }
@ -2563,9 +2565,11 @@ void G_CopyBufferToTexture(G_CommandListHandle cl_handle, G_ResourceHandle dst_h
void G_CopyTextureToTexture(G_CommandListHandle cl_handle, G_ResourceHandle dst_handle, Vec3I32 dst_offset, G_ResourceHandle src_handle, Rng3I32 src_copy_range) void G_CopyTextureToTexture(G_CommandListHandle cl_handle, G_ResourceHandle dst_handle, Vec3I32 dst_offset, G_ResourceHandle src_handle, Rng3I32 src_copy_range)
{ {
if (src_copy_range.p1.x > src_copy_range.p0.x && if (
src_copy_range.p1.x > src_copy_range.p0.x &&
src_copy_range.p1.y > src_copy_range.p0.y && src_copy_range.p1.y > src_copy_range.p0.y &&
src_copy_range.p1.z > src_copy_range.p0.z) src_copy_range.p1.z > src_copy_range.p0.z
)
{ {
G_D12_SharedState *g = &G_D12_shared_state; G_D12_SharedState *g = &G_D12_shared_state;
G_D12_CmdList *cl = G_D12_CmdListFromHandle(cl_handle); G_D12_CmdList *cl = G_D12_CmdListFromHandle(cl_handle);
@ -2638,12 +2642,14 @@ void G_Compute(G_CommandListHandle cl_handle, ComputeShader cs, Vec3I32 groups)
//- Rasterize //- Rasterize
void G_Rasterize(G_CommandListHandle cl_handle, void G_Rasterize(
VertexShader vs, PixelShader ps, G_CommandListHandle cl_handle,
u32 instances_count, G_IndexBufferDesc index_buffer, VertexShader vs, PixelShader ps,
u32 render_targets_count, G_ResourceHandle *render_targets, u32 instances_count, G_IndexBufferDesc index_buffer,
Rng3 viewport, Rng2 scissor, u32 render_targets_count, G_ResourceHandle *render_targets,
G_RasterMode mode) Rng3 viewport, Rng2 scissor,
G_RasterMode mode
)
{ {
G_D12_CmdList *cl = G_D12_CmdListFromHandle(cl_handle); G_D12_CmdList *cl = G_D12_CmdListFromHandle(cl_handle);
G_D12_Cmd *cmd = G_D12_PushCmd(cl); G_D12_Cmd *cmd = G_D12_PushCmd(cl);
@ -3059,7 +3065,8 @@ void G_D12_CollectionWorkerEntryPoint(WaveLaneCtx *lane)
/* Copy print buffer to readback buffer */ /* Copy print buffer to readback buffer */
G_CopyBufferToBuffer(cl, queue->print_readback_buffer, 0, queue->print_buffer, RNGU64(0, queue->print_buffer_size)); G_CopyBufferToBuffer(cl, queue->print_readback_buffer, 0, queue->print_buffer, RNGU64(0, queue->print_buffer_size));
/* Reset counters to 0 */ /* Reset counters to 0 */
G_MemorySync(cl, queue->print_buffer, G_MemorySync(
cl, queue->print_buffer,
G_Stage_Copy, G_Access_CopyRead, G_Stage_Copy, G_Access_CopyRead,
G_Stage_Copy, G_Access_CopyWrite G_Stage_Copy, G_Access_CopyWrite
); );

View File

@ -81,12 +81,14 @@ String StringFromMetaErrors(Arena *arena, M_ErrorList errors)
{ {
line_col = LineColFromPos(token_file_data, token_pos); line_col = LineColFromPos(token_file_data, token_pos);
} }
String formatted = StringF(scratch.arena, String formatted = StringF(
"%F:%F:%F: error: %F", scratch.arena,
FmtString(token_file), "%F:%F:%F: error: %F",
FmtSint(line_col.line), FmtString(token_file),
FmtSint(line_col.col), FmtSint(line_col.line),
FmtString(e->msg)); FmtSint(line_col.col),
FmtString(e->msg)
);
PushStringToList(scratch.arena, &error_strings, formatted); PushStringToList(scratch.arena, &error_strings, formatted);
} }
else else
@ -824,14 +826,16 @@ void BuildEntryPoint(WaveLaneCtx *lane)
if (lane->idx == WaveLaneIdxFromTaskIdx(lane, task_idx++) && GetBuildStatus() == 0) if (lane->idx == WaveLaneIdxFromTaskIdx(lane, task_idx++) && GetBuildStatus() == 0)
{ {
Build.c_obj.obj_file = StringF(perm, "%F_gen_c.obj", FmtString(cmdline.leaf_layer_name)); Build.c_obj.obj_file = StringF(perm, "%F_gen_c.obj", FmtString(cmdline.leaf_layer_name));
String cmd = StringF(perm, String cmd = StringF(
"cl.exe /c %F -Fo:%F %F %F %F %F", perm,
FmtString(c_out_file), "cl.exe /c %F -Fo:%F %F %F %F %F",
FmtString(Build.c_obj.obj_file), FmtString(c_out_file),
FmtString(StringFromList(perm, cp.flags_msvc, Lit(" "))), FmtString(Build.c_obj.obj_file),
FmtString(StringFromList(perm, cp.compiler_only_flags_msvc, Lit(" "))), FmtString(StringFromList(perm, cp.flags_msvc, Lit(" "))),
FmtString(StringFromList(perm, cp.warnings_msvc, Lit(" "))), FmtString(StringFromList(perm, cp.compiler_only_flags_msvc, Lit(" "))),
FmtString(StringFromList(perm, cp.defs, Lit(" ")))); FmtString(StringFromList(perm, cp.warnings_msvc, Lit(" "))),
FmtString(StringFromList(perm, cp.defs, Lit(" ")))
);
OS_CommandResult cmd_result = OS_RunCommand(perm, cmd); OS_CommandResult cmd_result = OS_RunCommand(perm, cmd);
String cmd_output = TrimWhitespace(cmd_result.output); String cmd_output = TrimWhitespace(cmd_result.output);
Build.c_obj.output = cmd_output; Build.c_obj.output = cmd_output;
@ -861,14 +865,16 @@ void BuildEntryPoint(WaveLaneCtx *lane)
: e->kind == ShaderEntryKind_PS ? Lit("ps_6_6") : e->kind == ShaderEntryKind_PS ? Lit("ps_6_6")
: e->kind == ShaderEntryKind_CS ? Lit("cs_6_6") : e->kind == ShaderEntryKind_CS ? Lit("cs_6_6")
: Lit("vs_6_6"); : Lit("vs_6_6");
String compile_cmd = StringF(perm, String compile_cmd = StringF(
"dxc.exe -T %F -E %F -Fo %F %F %F %F", perm,
FmtString(target), "dxc.exe -T %F -E %F -Fo %F %F %F %F",
FmtString(e->name), FmtString(target),
FmtString(out_file), FmtString(e->name),
FmtString(gpu_out_file), FmtString(out_file),
FmtString(StringFromList(perm, cp.defs, Lit(" "))), FmtString(gpu_out_file),
FmtString(StringFromList(perm, cp.flags_dxc, Lit(" ")))); FmtString(StringFromList(perm, cp.defs, Lit(" "))),
FmtString(StringFromList(perm, cp.flags_dxc, Lit(" ")))
);
OS_CommandResult cmd_result = OS_RunCommand(perm, compile_cmd); OS_CommandResult cmd_result = OS_RunCommand(perm, compile_cmd);
gpu_obj->output = cmd_result.output; gpu_obj->output = cmd_result.output;
@ -937,12 +943,14 @@ void BuildEntryPoint(WaveLaneCtx *lane)
obj_files_str = StringFromList(perm, obj_files, Lit(" ")); obj_files_str = StringFromList(perm, obj_files, Lit(" "));
} }
String cmd = StringF(perm, String cmd = StringF(
"link.exe %F /OUT:%F %F %F", perm,
FmtString(obj_files_str), "link.exe %F /OUT:%F %F %F",
FmtString(exe_file), FmtString(obj_files_str),
FmtString(StringFromList(perm, cp.flags_msvc, Lit(" "))), FmtString(exe_file),
FmtString(StringFromList(perm, cp.linker_only_flags_msvc, Lit(" ")))); FmtString(StringFromList(perm, cp.flags_msvc, Lit(" "))),
FmtString(StringFromList(perm, cp.linker_only_flags_msvc, Lit(" ")))
);
OS_CommandResult result = OS_RunCommand(perm, cmd); OS_CommandResult result = OS_RunCommand(perm, cmd);
Build.link.output = TrimWhitespace(result.output); Build.link.output = TrimWhitespace(result.output);
Build.link.return_code = result.code; Build.link.return_code = result.code;

View File

@ -12,7 +12,8 @@ String W32_StringFromError(Arena *arena, DWORD err)
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)&msg_cstr, (LPSTR)&msg_cstr,
0, 0,
0); 0
);
if (len > 0) if (len > 0)
{ {
result = PushString(arena, TrimWhitespace(StringFromCstr(msg_cstr, len))); result = PushString(arena, TrimWhitespace(StringFromCstr(msg_cstr, len)));

View File

@ -289,10 +289,12 @@ void P_MkDir(String path)
} }
if (err.len > 0) if (err.len > 0)
{ {
String msg = StringF(scratch.arena, String msg = StringF(
"Failed to create directory \"%F\": %F", scratch.arena,
FmtString(path), "Failed to create directory \"%F\": %F",
FmtString(err)); FmtString(path),
FmtString(err)
);
Panic(msg); Panic(msg);
} }
EndScratch(scratch); EndScratch(scratch);

View File

@ -1072,7 +1072,8 @@ void V_TickForever(WaveLaneCtx *lane)
FmtUint(datetime.minute, .z = 2), FmtUint(datetime.minute, .z = 2),
FmtUint(datetime.second, .z = 2), FmtUint(datetime.second, .z = 2),
FmtUint(datetime.milliseconds, .z = 3), FmtUint(datetime.milliseconds, .z = 3),
FmtString(text)); FmtString(text)
);
} }
UI_PushCP(UI_NilKey); UI_PushCP(UI_NilKey);
{ {

View File

@ -1440,15 +1440,17 @@ void PP_UpdateUser(void)
"normal: (%F, %F)\n" "normal: (%F, %F)\n"
"num contacts: %F" "num contacts: %F"
); );
String text = StringF(temp.arena, fmt, String text = StringF(
FmtUint(e0->key.idx), temp.arena, fmt,
FmtUint(e1->key.idx), FmtUint(e0->key.idx),
FmtHex(point.key), FmtUint(e1->key.idx),
FmtFloat(point.normal_impulse), FmtHex(point.key),
FmtFloat(point.tangent_impulse), FmtFloat(point.normal_impulse),
FmtFloatP(point.starting_separation, 6), FmtFloat(point.tangent_impulse),
FmtFloatP(data->normal.x, 6), FmtFloatP(data->normal.y, 6), FmtFloatP(point.starting_separation, 6),
FmtUint(data->num_points)); FmtFloatP(data->normal.x, 6), FmtFloatP(data->normal.y, 6),
FmtUint(data->num_points)
);
draw_text(g->render_sig, disp_font, AddVec2(RoundVec2(MulXformV2(g->world_to_ui_xf, dbg_pt)), VEC2(0, offset_px)), text); draw_text(g->render_sig, disp_font, AddVec2(RoundVec2(MulXformV2(g->world_to_ui_xf, dbg_pt)), VEC2(0, offset_px)), text);
} }
@ -1557,11 +1559,13 @@ void PP_UpdateUser(void)
"e1 pos: (%F, %F)\n" "e1 pos: (%F, %F)\n"
"e1 rot: %F\n" "e1 rot: %F\n"
); );
String text = StringF(temp.arena, fmt, String text = StringF(
FmtFloatP(e0_xf.og.x, 24), FmtFloatP(e0_xf.og.y, 24), temp.arena, fmt,
FmtFloatP(RotationFromXform(e0_xf), 24), FmtFloatP(e0_xf.og.x, 24), FmtFloatP(e0_xf.og.y, 24),
FmtFloatP(e1_xf.og.x, 24), FmtFloatP(e1_xf.og.y, 24), FmtFloatP(RotationFromXform(e0_xf), 24),
FmtFloatP(RotationFromXform(e1_xf), 24)); FmtFloatP(e1_xf.og.x, 24), FmtFloatP(e1_xf.og.y, 24),
FmtFloatP(RotationFromXform(e1_xf), 24)
);
draw_text(g->render_sig, disp_font, AddVec2(RoundVec2(MulXformV2(g->world_to_ui_xf, VEC2(0, 0))), VEC2(0, offset_px)), text); draw_text(g->render_sig, disp_font, AddVec2(RoundVec2(MulXformV2(g->world_to_ui_xf, VEC2(0, 0))), VEC2(0, offset_px)), text);
} }
@ -2261,15 +2265,17 @@ void PP_UpdateUser(void)
sig.sampler = GPU_SamplerStateRidFromResource(GPU_GetCommonPointSampler()); sig.sampler = GPU_SamplerStateRidFromResource(GPU_GetCommonPointSampler());
sig.instances = GPU_StructuredBufferRidFromResource(material_instances_buffer); sig.instances = GPU_StructuredBufferRidFromResource(material_instances_buffer);
sig.grids = GPU_StructuredBufferRidFromResource(grids_buffer); sig.grids = GPU_StructuredBufferRidFromResource(grids_buffer);
GPU_Rasterize(cl, GPU_Rasterize(
&sig, cl,
PP_MaterialVS, PP_MaterialPS, &sig,
2, PP_MaterialVS, PP_MaterialPS,
viewport, 2,
scissor, viewport,
material_instances_count, scissor,
GPU_GetCommonQuadIndices(), material_instances_count,
GPU_RasterizeMode_TriangleList); GPU_GetCommonQuadIndices(),
GPU_RasterizeMode_TriangleList
);
} }
//- Prep flood pass //- Prep flood pass
@ -2352,10 +2358,12 @@ void PP_UpdateUser(void)
sig.tex_width = g->render_size.x; sig.tex_width = g->render_size.x;
sig.tex_height = g->render_size.y; sig.tex_height = g->render_size.y;
sig.exposure = 2.0; sig.exposure = 2.0;
sig.frame_seed = VEC4U32((u32)(RandU64FromState(&g->frame_rand) & 0xFFFFFFFF), sig.frame_seed = VEC4U32(
(u32)(RandU64FromState(&g->frame_rand) & 0xFFFFFFFF), (u32)(RandU64FromState(&g->frame_rand) & 0xFFFFFFFF),
(u32)(RandU64FromState(&g->frame_rand) & 0xFFFFFFFF), (u32)(RandU64FromState(&g->frame_rand) & 0xFFFFFFFF),
(u32)(RandU64FromState(&g->frame_rand) & 0xFFFFFFFF)); (u32)(RandU64FromState(&g->frame_rand) & 0xFFFFFFFF),
(u32)(RandU64FromState(&g->frame_rand) & 0xFFFFFFFF)
);
sig.frame_index = g->frame_index; sig.frame_index = g->frame_index;
sig.camera_offset = g->world_to_render_xf.og; sig.camera_offset = g->world_to_render_xf.og;
sig.noise = GPU_Texture3DRidFromResource(GPU_GetCommonNoise()); sig.noise = GPU_Texture3DRidFromResource(GPU_GetCommonNoise());

View File

@ -103,7 +103,8 @@ UI_Box *PP_BuildDebugConsole(b32 minimized)
FmtUintZ(datetime.minute, 2), FmtUintZ(datetime.minute, 2),
FmtUintZ(datetime.second, 2), FmtUintZ(datetime.second, 2),
FmtUintZ(datetime.milliseconds, 3), FmtUintZ(datetime.milliseconds, 3),
FmtString(text)); FmtString(text)
);
} }
UI_PushCP(0); UI_PushCP(0);
{ {

View File

@ -21,11 +21,13 @@ void PT_RunForever(WaveLaneCtx *lane)
{ {
/* Push resources */ /* Push resources */
Vec2I32 final_target_size = window_frame.draw_size; Vec2I32 final_target_size = window_frame.draw_size;
G_ResourceHandle final_target = G_PushTexture2D(gpu_frame_arena, G_ResourceHandle final_target = G_PushTexture2D(
G_Format_R16G16B16A16_Float, gpu_frame_arena,
final_target_size, G_Format_R16G16B16A16_Float,
G_Layout_DirectQueue_ShaderReadWrite, final_target_size,
.flags = G_ResourceFlag_AllowShaderReadWrite); G_Layout_DirectQueue_ShaderReadWrite,
.flags = G_ResourceFlag_AllowShaderReadWrite
);
/* Push resource handles */ /* Push resource handles */
G_Texture2DRef final_target_rhandle = G_PushTexture2DRef(gpu_frame_arena, final_target); G_Texture2DRef final_target_rhandle = G_PushTexture2DRef(gpu_frame_arena, final_target);
@ -54,12 +56,14 @@ void PT_RunForever(WaveLaneCtx *lane)
/* Blit pass */ /* Blit pass */
{ {
G_Rasterize(cl, G_Rasterize(
PT_BlitVS, PT_BlitPS, cl,
1, G_GetSharedQuadIndices(), PT_BlitVS, PT_BlitPS,
1, &window_frame.backbuffer, 1, G_GetSharedQuadIndices(),
G_ViewportFromTexture(window_frame.backbuffer), G_ScissorFromTexture(window_frame.backbuffer), 1, &window_frame.backbuffer,
G_RasterMode_TriangleList); G_ViewportFromTexture(window_frame.backbuffer), G_ScissorFromTexture(window_frame.backbuffer),
G_RasterMode_TriangleList
);
} }
/* Finalize backbuffer layout */ /* Finalize backbuffer layout */

View File

@ -25,15 +25,17 @@ String SETTINGS_StringFromWindowSettings(Arena *arena, const P_WindowSettings *s
"}\n" "}\n"
); );
String formatted = FormatString(arena, String formatted = FormatString(
fmt, ,
FmtString(minimized), fmt,
FmtString(maximized), FmtString(minimized),
FmtString(fullscreen), FmtString(maximized),
FmtSint(x), FmtString(fullscreen),
FmtSint(y), FmtSint(x),
FmtSint(width), FmtSint(y),
FmtSint(height)); FmtSint(width),
FmtSint(height)
);
return formatted; return formatted;
} }
@ -162,11 +164,13 @@ abort:
{ {
if (json_error.msg.len > 0) if (json_error.msg.len > 0)
{ {
*error_out = StringF(arena, *error_out = StringF(
Lit("%F\n(%F:%F)"), arena,
FmtString(json_error.msg), Lit("%F\n(%F:%F)"),
FmtUint(json_error.start), FmtString(json_error.msg),
FmtUint(json_error.end)); FmtUint(json_error.start),
FmtUint(json_error.end)
);
} }
else else
{ {

View File

@ -85,10 +85,12 @@ AC_Asset *SND_LoadAsset(ResourceKey resource, SND_SoundFlag flags, b32 wait)
/* Generate and append sound flags to name key */ /* Generate and append sound flags to name key */
String name = NameFromResource(resource); String name = NameFromResource(resource);
String key = StringF(scratch.arena, String key = StringF(
"%F%F_sound", scratch.arena,
FmtString(name), "%F%F_sound",
FmtUint((u64)flags)); FmtString(name),
FmtUint((u64)flags)
);
u64 hash = AC_HashFromKey(key); u64 hash = AC_HashFromKey(key);
b32 is_first_touch; b32 is_first_touch;
AC_Asset *asset = AC_TouchCache(key, hash, &is_first_touch); AC_Asset *asset = AC_TouchCache(key, hash, &is_first_touch);

View File

@ -24,20 +24,24 @@ JobImpl(SPR_LoadTexture, sig, _)
if (ok) if (ok)
{ {
GPU_ArenaHandle gpu_perm = GPU_PermArena(); GPU_ArenaHandle gpu_perm = GPU_PermArena();
GPU_ResourceHandle gpu_resource = GPU_PushTexture2D(gpu_perm, GPU_ResourceHandle gpu_resource = GPU_PushTexture2D(
GPU_Format_R8G8B8A8_Unorm_Srgb, gpu_perm,
VEC2I32(decoded.width, decoded.height), GPU_Format_R8G8B8A8_Unorm_Srgb,
GPU_Layout_AnyQueue_ShaderRead_CopyRead_CopyWrite_Present); VEC2I32(decoded.width, decoded.height),
GPU_Layout_AnyQueue_ShaderRead_CopyRead_CopyWrite_Present
);
// texture->texture = gpu_tex; // texture->texture = gpu_tex;
texture->width = decoded.width; texture->width = decoded.width;
texture->height = decoded.height; texture->height = decoded.height;
GPU_CommandListHandle cl = GPU_PrepareCommandList(); GPU_CommandListHandle cl = GPU_PrepareCommandList();
{ {
GPU_ReadTexelsFromCpu(cl, GPU_ReadTexelsFromCpu(
gpu_resource, VEC3I32(0,0,0), cl,
decoded.pixels, VEC3I32(decoded.width, decoded.height, 1), gpu_resource, VEC3I32(0,0,0),
RNG3I32(VEC3I32(0,0,0), VEC3I32(decoded.width, decoded.height, 1))); decoded.pixels, VEC3I32(decoded.width, decoded.height, 1),
RNG3I32(VEC3I32(0,0,0), VEC3I32(decoded.width, decoded.height, 1))
);
} }
GPU_CommitCommandList(cl, GPU_QueueKind_AsyncCopy); GPU_CommitCommandList(cl, GPU_QueueKind_AsyncCopy);
} }

View File

@ -1411,23 +1411,27 @@ void UI_EndFrame(UI_Frame *frame)
if (rects_count > 0) if (rects_count > 0)
{ {
/* Render rects */ /* Render rects */
G_Rasterize(frame->cl, G_Rasterize(
UI_DRectVS, UI_DRectPS, frame->cl,
rects_count, G_QuadIndices(), UI_DRectVS, UI_DRectPS,
1, &draw_target, rects_count, G_QuadIndices(),
draw_viewport, draw_scissor, 1, &draw_target,
G_RasterMode_TriangleList); draw_viewport, draw_scissor,
G_RasterMode_TriangleList
);
/* Render rect wireframes */ /* Render rect wireframes */
if (AnyBit(frame->frame_flags, UI_FrameFlag_Debug)) if (AnyBit(frame->frame_flags, UI_FrameFlag_Debug))
{ {
G_SetConstant(frame->cl, UI_ShaderConst_DebugDraw, 1); G_SetConstant(frame->cl, UI_ShaderConst_DebugDraw, 1);
G_Rasterize(frame->cl, G_Rasterize(
UI_DRectVS, UI_DRectPS, frame->cl,
rects_count, G_QuadIndices(), UI_DRectVS, UI_DRectPS,
1, &draw_target, rects_count, G_QuadIndices(),
draw_viewport, draw_scissor, 1, &draw_target,
G_RasterMode_WireTriangleList); draw_viewport, draw_scissor,
G_RasterMode_WireTriangleList
);
} }
} }
@ -1437,12 +1441,14 @@ void UI_EndFrame(UI_Frame *frame)
G_DumbMemoryLayoutSync(frame->cl, backbuffer, G_Layout_DirectQueue_RenderTargetWrite); G_DumbMemoryLayoutSync(frame->cl, backbuffer, G_Layout_DirectQueue_RenderTargetWrite);
{ {
G_Rasterize(frame->cl, G_Rasterize(
UI_BlitVS, UI_BlitPS, frame->cl,
1, G_QuadIndices(), UI_BlitVS, UI_BlitPS,
1, &backbuffer, 1, G_QuadIndices(),
monitor_viewport, monitor_scissor, 1, &backbuffer,
G_RasterMode_TriangleList); monitor_viewport, monitor_scissor,
G_RasterMode_TriangleList
);
} }
G_DumbMemoryLayoutSync(frame->cl, backbuffer, G_Layout_AnyQueue_ShaderRead_CopyRead_CopyWrite_Present); G_DumbMemoryLayoutSync(frame->cl, backbuffer, G_Layout_AnyQueue_ShaderRead_CopyRead_CopyWrite_Present);