GUI fields now trim leading and trailing whitespace:

This commit is contained in:
Dmitry Sergeev
2026-09-02 00:23:03 +03:00
parent e7b032ce77
commit da5ff8ea4a
9 changed files with 200 additions and 15 deletions
+19 -12
View File
@@ -455,7 +455,12 @@ func validateFramePayload(
// DrawFrame acquires an image, records commands, submits, and presents.
// Returns ErrOutOfDate if the swapchain needs recreation
func (r *Renderer) DrawFrame(videoW, videoH, stride uint32) error {
func (r *Renderer) DrawFrame(
videoW uint32,
videoH uint32,
stride uint32,
showVideo bool,
) error {
imageIndex, res := r.dev.AcquireNextImage(r.swapchain, r.imageAvailable, ^uint64(0))
if res == vk.ErrorOutOfDateKHR || res == vk.SuboptimalKHR {
return ErrOutOfDate
@@ -483,7 +488,7 @@ func (r *Renderer) DrawFrame(videoW, videoH, stride uint32) error {
r.fbs[imageIndex],
vk.Rect2D{Offset: vk.Offset2D{X: 0, Y: 0}, Extent: r.extent},
[]vk.ClearValue{
vk.ClearColor(0.0, 0.0, 0.0, 1.0),
vk.ClearColor(0.025, 0.03, 0.04, 1.0),
vk.ClearDepthStencil(1.0, 0),
},
)
@@ -494,17 +499,19 @@ func (r *Renderer) DrawFrame(videoW, videoH, stride uint32) error {
MinDepth: 0, MaxDepth: 1,
})
cmd.SetScissor(vk.Rect2D{Offset: vk.Offset2D{X: 0, Y: 0}, Extent: r.extent})
cmd.BindPipeline(r.decodePipeline)
cmd.BindDescriptorSet(r.decodeLayout, 0, r.decodeSet)
pc := PushConstants{
Width: videoW,
Height: videoH,
StrideBytes: stride,
WinW: r.extent.Width,
WinH: r.extent.Height,
if showVideo {
cmd.BindPipeline(r.decodePipeline)
cmd.BindDescriptorSet(r.decodeLayout, 0, r.decodeSet)
pc := PushConstants{
Width: videoW,
Height: videoH,
StrideBytes: stride,
WinW: r.extent.Width,
WinH: r.extent.Height,
}
cmd.PushConstants(r.decodeLayout, vk.ShaderStageFragment, 0, unsafe.Pointer(&pc), 20)
cmd.Draw(3, 1, 0, 0)
}
cmd.PushConstants(r.decodeLayout, vk.ShaderStageFragment, 0, unsafe.Pointer(&pc), 20)
cmd.Draw(3, 1, 0, 0)
if r.ImGuiDraw != nil {
r.ImGuiDraw(cmd)
}