Commit Graph

5506 Commits

Author SHA1 Message Date
Bill Currie c9e7810864 [vulkan] Add resource memory offset to qfv_resobj_s
Its value on input is ignored. QFV_CreateResource writes the resource
object's offset relative to the beginning of the shared memory block.
Needed for the Draw overhaul.
2022-10-03 09:14:29 +09:00
Bill Currie c028e15943 [vulkan] Add a couple of staging helper functions
I got tired of writing the same 13 or so lines of code over and over (it
actually put me off experimenting with Vulkan). Thus...

QFV_PacketCopyBuffer does the work of handling barriers and a (full
packet) copy from the staging buffer to a GPU buffer.

QFV_PacketCopyImage does a similar job, but for images. However, it
still needs a lot of work, but it does make getting a basic texture onto
the GPU much less of a hassle.

Both functions should make staging data much less error-prone.
2022-10-03 09:09:34 +09:00
Bill Currie 51b73eee73 [renderer] Add fontid to Draw_AddFont and Draw_FontString
It's not used yet, but the vulkan draw implementation will eventually
support multiple fonts being loaded (and rendered at a time).
2022-10-03 09:01:54 +09:00
Bill Currie 0352af4542 [vulkan] Initialize resource image from tex_t
This moves the qfv_resobj_t image initialization code from the IQM
loader into the resource management code. This will allow me to reuse
the code for setting up glyph data. As a bonus, it cleans up the IQM
code nicely.
2022-10-02 20:45:20 +09:00
Bill Currie ac8d71733e [vulkan] Clean up QFV_duSetObjectName usage a little
Moving the param calculations into QFV_duSetObjectName params prevents
warnings when debug is disabled without having to use (void) hacks.
2022-10-02 15:07:04 +09:00
Bill Currie 9798400cfb [ui] Add a sub-system for parsing text passages
A passage object has a list of all the text objects in the given string,
where the objects represent either white space or "words", as well as a
view_t object representing the entire passage, with paragraphs split
into child views of the passage view, and each paragraph has a child
view for every text/space object in the paragraph.

Paragraphs are split by '\n' (not included in any object).

White space is grouped into clumps such that multiple adjacent spaces
form a single object. The standard ASCII space (0x20) and all of the
Unicode characters marked "WS;<compat> 0020" are counted as white space.
Unless a white space object is the first in the paragraph, its view is
marked for suppression by the view flow code.

Contiguous non-white space characters are grouped into single objects,
and their views are not suppressed.

All text object views (both white space and "word") have their data
pointer set to the psg_text_t object representing the text for that
view. This should be suitable for simple text-mode unattributed display.
More advanced rendering would probably want to create suitable objects
and set the view data pointers to those objects.

No assumption is made about text direction.

Passage and paragraph views need to have their primary axis sizes set
appropriately, as well as their resize flags. Their xlen and ylen are
both set to 10, and xpos,ypos is 0,0. Paragraph views need their
setgeometry pointer set to the appropriate view_flow_* function.
However, they are set up to have their secondary axis set automatically
when flowed.

Text object views are set up for automatic flowing: grav_flow, 0,0 for
xpos,ypos. However, xlen and ylen are also both 0, so need to be set by
the renderer before attempting to flow the text.
2022-09-30 19:51:14 +09:00
Bill Currie a24fb0ff6a [ui] Add option to auto-fit container to flowed views
Adjusting the size of the parent (container) view to the views it
contains will be useful for automatic layout and knowing how large the
view is for scrolling. New tests added so testing both with and without
the option is still possible.
2022-09-30 11:59:21 +09:00
Bill Currie 378584f41d [ui] Add functions for flow-based automatic layout
This should be suitable for laying out text objects with word-wrap,
where each view is a "word" or break between "words". This should be
useful for any other objects that could benefit from similar layout
rules. All eight flows are supported left-right-top-down (English and
most European languages), right-left-top-down (Arabic and similar),
top-down-right-left (Chinese, Japanese, Korean), top-down-left-right,
as well as bottom-up variants of those four.

More work is needed for support of things like views being centered on
the flow line rather than on one edge (depends on flow direction),
offset views, and others. Suppression of "spaces" at the beginning of a
line is supported but not tested.
2022-09-29 23:54:12 +09:00
Bill Currie c0e3821fa6 [gl/glsl] Shift the 2d view by 0.5 pixels in X and Y
Fixes top and left edge lines not being visible (same story as vulkan).
2022-09-28 22:50:44 +09:00
Bill Currie 2d634b7cf7 [vulkan] Shift the 2d view by 0.5 pixels in X and Y
Lines drawn along the top and left edges were not displayed because
they were just off screen.
2022-09-28 22:24:22 +09:00
Bill Currie ba9a071b1c [console] Fix console sliding and resize
Due to the changes related to console views, the console was either
fully visible or not at all visible, so it took several seconds to
disappear whenever closed.

Taking the screen data from the event fixes the console size being out
due to screen_view updating after the app_window event fires. Really,
this makes it independent of the order.
2022-09-28 21:57:10 +09:00
Bill Currie 60e712f224 [vulkan] Use the right uvs for lines
UVs being 0 meant that lines were picking up the upper left pixel of
char 0 of conchars. With quake data, this meant a transparent pixel.
Fixes invisible debug lines :P.
2022-09-28 21:53:22 +09:00
Bill Currie 49acf7035d [vulkaan] Fix incorrect conback drawing
Putting the console background image in the scrap needed different
calculations for the sliding console, but I rather messed things up.
2022-09-28 18:29:53 +09:00
Bill Currie df6f51b891 [glsl] Fix some mangled whitespace 2022-09-28 18:29:13 +09:00
Bill Currie 10f85edb21 [vulkan] Calculate the size of the capture buffer
It turns out that using the swapchain image for the size requirements is
unreliable: when running under renderdoc, vkGetImageMemoryRequirements
sets the memory requirements fields to 0, leading eventually to a null
memory object being passed to vkMapMemory, which does not end well.
2022-09-28 02:46:09 +09:00
Bill Currie 71e07e6454 [vulkan] Use vkCmdCopyImageToBuffer for screenshot capture
I had missed that vkCmdCopyImage requires the source and destination
images to have exactly the same size, and I guess assumed that the
swapchain images would always be the size they said they were, but this
is not the case for tiled-optimal images. However,
vkCmdCopyImageToBuffer does the right thing regardless of the source
image size.

This fixes the skewed screenshots when the window size is not a multiple
of 8 (for me, might differ for others).
2022-09-26 15:54:20 +09:00
Bill Currie 950d6d1472 [vulkan] Name the default magenta array view
It hasn't caused any problems, but the more objects I can name, the
better.
2022-09-26 13:08:02 +09:00
Bill Currie 1d50940c2a [vulkan] Implement window resize support
There's a problem with screenshot capture in that the image is sheared
after window resize, but the screen view looks good, and vulkan is happy
with the state changes.
2022-09-26 13:04:56 +09:00
Bill Currie 22276ad356 [vulkan] Remove double destroy of the old swapchain
I had forgotten that QFV_CreateSwapchain destroys the old swapchain when
I wrote Vulkan_CreateSwapchain.
2022-09-26 11:49:11 +09:00
Bill Currie d5586730a4 [vulkan] Remove redundant pipeline dynamic setting
As gbuf_base derives from the base pipeline, it inherits base's dynamic
setting, and thus doesn't need its own. I had a FIXME there as I wasn't
sure why I had a redundant setting, but I really can't see why I'd want
it different from any of the other main renderpass pipelines.
2022-09-26 10:07:12 +09:00
Bill Currie 0ecdd0e86b [vulkan] Rearrange init code in preparation for resizing
I've found and mostly isolated the parts of the code that will be
affected by window resizing, minus pipelines but they use dynamic
viewport and scissor settings and thus shouldn't be affected so long as
the swapchain format doesn't change (how does that happen?)
2022-09-26 09:52:14 +09:00
Bill Currie 9e440ff330 [renderer] Use designated inits on more structs
Finally, the model_funcs and render_funcs struts use designated
initializers. Not only are they good for ensuring correct
initialization, they're great for the programmer finding the right
initializer.
2022-09-25 10:37:07 +09:00
Bill Currie 5e154bf1b7 [cvar] Remove reliance on line number for developer parsing
I must have forgotten about the SYS_DeveloperID_... enum values, when I
wrote that code, because relying on the line number is not really for
the best.
2022-09-24 18:26:25 +09:00
Bill Currie c580fb9ec7 [console] Add a comment about console resizing
Due to design issues in the console API that I don't feel like
addressing at this stage, the console view is not a child of the
client's screen view (not even sure it should be in the first place), so
it won't get resized automatically when the client's screen view
resizes. However, ie_app_window is sent when the screen size changes,
and the console has to process input events anyway, so it's quite
reasonable to handle the event.
2022-09-22 16:18:53 +09:00
Bill Currie 7e03f23146 [renderer] Link plugins against external libraries
With the addition of dependencies on freetype and harfbuzz, it became
clear that the renderer plugins need to be explicitly linked against
external dependencies (and that I need to do more installed testing,
rather than just my static local builds). This fixes the unresolved
symbols when attempting to load any of the plugins.
2022-09-22 15:10:10 +09:00
Bill Currie 7c09f86d8d [models] Include fullbright in vulkan lib
I'm not sure why the other renderers are ok with Mod_CalcFullbright, but
the vulkan plugin couldn't find it.
2022-09-22 13:04:26 +09:00
Bill Currie d1f6945747 [renderer] Avoid gl/glsl segfault when resizing qwaq
qwaq doesn't supply a backtile pic, so Draw_TileClear in the gl and glsl
renderers would segfault when qwaq's window width changed due to some
back-tile being drawn.
2022-09-22 10:39:03 +09:00
Bill Currie d7be237af9 [vulkan] Fix a merge dropping that missed a conview change 2022-09-22 10:38:26 +09:00
Bill Currie 20ee47404f Merge branch 'master' into wip-twod 2022-09-22 10:06:00 +09:00
Bill Currie 41a6ea3534 [gamecode] Use adjusted vector string for sscanf
There's not much point in converting commas to spaces if the result
isn't used. Fixes several malformed vector errors in ad_tears.
2022-09-22 09:38:39 +09:00
Bill Currie 784af2bab2 [vulkan] Enable the multiview feature
As of a recent nvidia driver update, it became necessary to enable the
feature. I guess older drivers (or vulkan validation layers?) were a bit
slack in their checking (or perhaps I didn't actually get those lighting
changes working at the time despite having committed them).
2022-09-22 09:38:39 +09:00
Bill Currie 4b38d75f2c [input] Initialize the axis/button callback fields
Found these while trying to use the new code in my KSP addon.
2022-09-22 09:35:57 +09:00
Bill Currie aafb3c1d98 [vulkan] Partially document bsp rendering
This did involve changing some field names and a little bit of cleanup,
but I've got a better handle on what's going on (I think I was in one of
those coding trances where I quickly forget how things work).
2022-09-22 09:35:57 +09:00
Bill Currie ed209c3aa4 [util] Add a comment to darray test
Linux libc has its own "remove" (POSIX, even).
2022-09-22 09:35:57 +09:00
Bill Currie 2a47a61bc3 [util] Add atomic ring buffer and automated tests
Just head and tail are atomic, but it seems to work nicely (at least on
intel). I actually had more trouble with gcc (due to accidentally
testing lock-free with the wrong ring buffer... oops, but yup, gcc will
happily optimize your loop to spin really really fast). Also served as a
nice test for C11 threading.
2022-09-22 09:35:57 +09:00
Bill Currie be4978dc16 [vulkan] Update staging test for properties2 2022-09-22 09:35:57 +09:00
Bill Currie 035595dd7e [vulkan] Clean up bsp global access
This makes bsp traversal even more re-entrant (needed for shadows).
Everything needed for a "pass" is taken from bsp_pass_t (or indirectly
through bspctx_t (though that too might need some revising)).
2022-09-22 09:35:57 +09:00
Bill Currie b8070e0141 [vulkan] Check for ambient lights
Ambient lights are represented by a point at infinity and a zero
direction vector (spherical lights have a non-zero direction vector but
the cone angle is 360 degrees). This fixes what appeared to be mangled
light renderers (it was actually just an ambient light being treated as
a directional light (point at infinity, but non-zero direction vector).
2022-09-22 09:35:57 +09:00
Bill Currie 8e7474f614 [vulkan] Hook up the shadow map render pass
There are some issues with the light renderers getting mangled, and only
the first light is even touched (just begin and end of render pass), but
this gets a lot of the framework into place.
2022-09-22 09:35:57 +09:00
Bill Currie c58a2e5f54 [vulkan] Remove unused command buffer and fence 2022-09-22 09:35:57 +09:00
Bill Currie 71813af090 [vulkan] Support creating render passes with no render pass
Sounds odd, but it's part of the problem with calling two different
things with essentially the same name. The "high level" render pass in
question may be a compute pass, or a complex series of (Vulkan) render
passes and so won't create a Vulkan render pass for the "high level"
render pass (I do need to come up with a better name for it).
2022-09-22 09:35:57 +09:00
Bill Currie 3058a5103f [renderer] Move entity drawing in with view rendering
I really don't remember why I made it separate, though it may have been
to do with r_ent_queue. However, putting it together with the rest is
needed for the "render pass" rework.
2022-09-22 09:35:57 +09:00
Bill Currie 5e1ce5b46e [vulkan] Move main render pass setup to Vulkan_Main
And support sorting of render passes by an order index.
2022-09-22 09:35:57 +09:00
Bill Currie e45867d335 [vulkan] Fix some segfaults for render passes with no framebuffer specs 2022-09-22 09:35:57 +09:00
Bill Currie 3b72c9847a [vulkan] Add list of views to qfv_output_t
I'm not sure I like it, but it was an easy solution to dealing with
per-frame views when setting up a renderpass that has a framebuffer
spec.
2022-09-22 09:35:57 +09:00
Bill Currie e1c4428c8e [vulkan] Set source item for cexpr errors
It's always nice getting at least line numbers from an error message
(even if I still have to hunt for the right source "file").
2022-09-22 09:35:56 +09:00
Bill Currie 3603fa75cd [vulkan] Make Vulkan_CreateRenderPass more generally useful
It now lives in vulkan_renderpass.c and takes most of its parameters
from plist configs (just the name (which is used to find the config),
output spec, and draw function from C). Even the debug colors and names
are taken from the config.
2022-09-22 09:35:56 +09:00
Bill Currie e14e8050dc [vulkan] Remove vkparse.hinc from vkparse.h
Kind of silly having the vkparse_internal define when it was just
bypassed anyway.
2022-09-22 09:35:56 +09:00
Bill Currie 08f33d2f3a [vulkan] Rename the renderpass files
I plan on moving the current hard-coded render pass creation from
vulkan_vid_common and this maintains the (possibly silly) naming
convention).
2022-09-22 09:35:56 +09:00
Bill Currie 6a7c2cb2a1 [vulkan] Clean out the old render pass creation code
QFV_CreateRenderPass is no longer used, and QFV_CreateFramebuffer hasn't
been used for a long time. The C file is still there for now but is
basically empty.
2022-09-22 09:35:56 +09:00
Bill Currie 78437c2c90 [vulkan] Parse VkRenderPass directly
QFV_CreateRenderPass doesn't support pNext and I don't particularly feel
like making it do so at this stage (tempted to remove it).
2022-09-22 09:35:56 +09:00
Bill Currie f04108ae3e [vulkan] Switch to using vkGetPhysicalDeviceProperties2
Necessary for getting VkPhysicalDeviceMultiviewProperties (and others,
but not at this time).
2022-09-22 09:35:56 +09:00
Bill Currie e5932d1f92 [vulkan] Support Vulkan's pNext in vkparse/vkgen
The real reason for the delay in implementing support for pNext is I
didn't know how to approach it at the time, but with the experience I've
gained using and modifying vkparse, the solution turned out to be fairly
simple. This allows for the use of various extensions (eg, multiview,
which was used for testing, though none of the hookup is in this
commit). No checking is done on the struct type being valid other than
it must be of a chainable type (ie, have its own pNext).
2022-09-22 09:35:56 +09:00
Bill Currie 125821fcdd [render] Add basic 2d line drawing
The software renderer uses Bresenham's line slice algorithm as presented
by Michael Abrash in his Graphics Programming Black Book Special Edition
with the serial numbers filed off (as such, more just so *I* can read
the code easily), along with the Chen-Sutherland line clipping
algorithm. The other renderers were more or less trivial in comparison.
2022-09-22 09:35:56 +09:00
Bill Currie 2e14300a11 [client] Auto-detect light color range
Some mappers use 0-255 and others use 0-1. Detection method adapted from
ericw light (seems to be a good bet as it seems to be popular).
2022-09-22 09:35:44 +09:00
Bill Currie c6d73eaf64 [vulkan] Add light count display
Enabled by 'developer lighting'. It was good for confirming that the
lights in ad_e1m1 (Doom Hangar 16) were actually being output (over 600
of them sometimes, ouch). Turned out to be the color scale ambiguity.
2022-09-22 09:31:04 +09:00
Bill Currie fb4bb22048 [client] Add cl_(min|max)(pitch|roll) cvars
The pitch cvars are taken from quakespasm because I ran into a button I
couldn't shoot with the 80 degree limit, but I figured I'd add roll
limits while I was at it.
2022-09-22 09:31:04 +09:00
Bill Currie 3603f90718 [vulkan] Implement BSP surface transparency
Surfaces marked with SURF_DRAWALPHA but not SURF_DRAWTURB are put in a
separate queue for the water shader and run with a turb scale of 0.
Also, entities with colormod alpha < 1 are marked to go in the same
queue as SURF_DRAWALPHA surfaces (ie, no SURF_DRAWTURB unless the
model's texture indicated such).
2022-09-22 09:31:04 +09:00
Bill Currie a936336e84 [model] Support the transparent texture marker
Textures whose names start with a { are meant to be rendered with
transparency. Surfaces using those textures are marked with
SURF_DRAWALPHA.

Unfortunately, the mip levels of ad_tears' transparent textures use the
wrong color so only the highest LOD works properly, but those textures
are meant to be loaded from external files anyway, it seems.
2022-09-22 09:31:04 +09:00
Bill Currie 3a03cc9fda [sw] Use vid instead of dev for a debug print 2022-09-22 01:49:18 +09:00
Bill Currie f758f5fb70 [renderer] Respond to window size changes
Currently, only gl, glsl and sw are working, vulkan needs its swapchain
to be rebuilt, and there are minor issues with the hud and console
resizing.
2022-09-22 01:15:06 +09:00
Bill Currie ef8b267826 [x11] Allow the window to be resized
There's no maximum size, but the minimum size is currently 32x20.
2022-09-22 01:09:27 +09:00
Bill Currie d149457241 [vid] Add a listener for window size changes
A listener is used instead of (really, as well as) ie_app_window events
because systems that need to know about windows sizes may not have
anything to do with input and the event system.
2022-09-22 01:07:54 +09:00
Bill Currie fdfdf9056a [renderer] Add function to destroy frame buffers
Needed for window resizing for fisheye and warp buffers (main buffers
will be taken care of by the drivers).
2022-09-21 23:47:14 +09:00
Bill Currie 4578b1af0d [vid] Remove console view from viddef_t
This breaks console scaling for now (con_width and con_height are gone),
but is a major step towards window resize support as console stuff
should never have been in viddef_t in the first place.

The client screen init code now sets up a screen view (actually the
renderer's scr_view) that is passed to the client console so it can know
the size of the screen. The same view is used by the status bar code.

Also, the ram/cache/paused icon drawing is moved into the client screen
update code. A bit of duplication, but I do plan on merging that
eventually.
2022-09-21 17:31:18 +09:00
Bill Currie 2473584759 [vid] Clean out an unused variable from context_win
It's dead, Jim.
2022-09-21 12:37:55 +09:00
Bill Currie 0921235aa6 [console] Fix a lot of the console view placement issues
Things seem to be at least close to the right place now.

Input line handling has been made more object-oriented in that the
collection of objects required for a single input line (command, say,
say_team) are bundled into one object with just one set of handlers for
resize and draw. Much tidier.
2022-09-21 12:37:55 +09:00
Bill Currie 230e23db5d [console] Update a little for event handling
Con_CheckResize is no longer necessary thanks to the ie_app_window
event, and the client doesn't need C_ProcessInput so that is now
optional.
2022-09-21 12:13:06 +09:00
Bill Currie 8be5d35b0d [ui] Add support for setting view data early
view_new sets the geometry, but any setgeometry that need a valid data
pointer would get null. It might be better to always have the data
pointer, but I didn't feel like doing such a change at this stage as
there are quite a lot of calls to view_new. Thus view_new_data which
sets the data pointer before calling setgeometry.
2022-09-21 11:53:49 +09:00
Bill Currie 058e919273 [renderer] Use better heuristics for scrap allocation
More tuning is needed on the actual splits as it falls over when the
lower rect gets too low for the subrects being allocated. However, the
scrap allocator itself will prefer exact width/height fits with larger
cutoff over inexact cuts with smaller cutoff. Many thanks to tdb for the
suggestions.

Fixes the fps dropping from ~3700fps down to ~450fps (cumulative due to
loss of POT rounding and very poor splitting layout), with a bonus boost
to about 4900fps (all speeds at 800x450). The 2d sprites were mostly ok,
but the lightmaps forming a capital gamma shape in a 4k texture really
hurt. Now the lightmaps are a nice dense bar at the top of the texture,
and 2d sprites are pretty good (slight improvement coming next).
2022-09-20 19:32:49 +09:00
Bill Currie 1fdedbaf33 [renderer] Report scrap rectangle counts
Stats are good. More stats even better :) I wanted to see just how many
lightmaps were being created in e1m3.
2022-09-20 19:32:41 +09:00
Bill Currie 398405c8d6 [console] Remove old_console_t struct
This replaces old_console_t with con_buffer_t for managing scrollback,
and draw_charbuffer_t for actual character drawing, reducing the number
of calls into the renderer. There are numerous issues with placement and
sizing, but the basics are working nicely.
2022-09-20 16:14:55 +09:00
Bill Currie d6d45bf07c [console] Add a function to clear the scroll-back buffer
Needed for when the console display is cleared.
2022-09-20 12:14:01 +09:00
Bill Currie 11e978b4db [console] Fix a signed comparison warning
I'm not sure why that didn't trigger in a linux build. Maybe gcc 12
assumed the result would be positive (I think I'm still using 11 for
mxe).
2022-09-20 10:50:15 +09:00
Bill Currie 474f01d321 [renderer] Return count of lines printed to char buffer
This allows users to know the number of terminated lines in the printed
text without having to redundantly count the lines.
2022-09-20 10:27:24 +09:00
Bill Currie 1cd6a174fe [build] Correct cygwin system type
cygwin is not windows, so trying to build a win32 app on cygwin-native
doesn't work too well.
2022-09-19 16:36:29 +01:00
Bill Currie e36adb07ec [net] Don't include windows.h or winsock.h directly
Including them kills the definition for CMSG_DATA.
2022-09-19 16:32:45 +01:00
Bill Currie 08328f4076 Fix some cygwin portability issues
Cygwin's headers seem to be rather out of date with respect to linux
with regards to signed types, especially ctype.
2022-09-19 16:31:08 +01:00
Bill Currie 745778979a [image] Update stub WritePNG's definition
Fixes some bitrot for when libpng is unavailable
2022-09-19 13:38:58 +01:00
Bill Currie 3eceb444d3 [console] Add test for buffer line tracking
Seems to work, so I guess con_buffer is ok now.
2022-09-18 16:07:22 +09:00
Bill Currie 48e5848a41 [console] Rework con_buffer ring buffers to have gaps
I really don't know why I tried to do ring-buffers without gaps, the
code complication is just not worth the tiny savings in memory. In fact,
just the switch from pointers to 32-bit offsets saves more memory than
not having gaps (on 64-bit systems, no change on 32-bit).
2022-09-18 11:35:09 +09:00
Bill Currie 5e8d18a774 [console] Add failing test for adding to full 1-line buffer
I've decided that appending to a full single-line buffer should simply
scroll through the existing text. Unsurprisingly, the existing code
doesn't handle the situation all that well. While I've already got a fix
for it, I think I've got a better idea that will handle full buffers
more gracefully.
2022-09-17 15:31:52 +09:00
Bill Currie c8c1d2e642 [console] Add a pile of of comments to Con_BufferAddText
And make tail_line setup a little clearer.
2022-09-17 14:22:28 +09:00
Bill Currie 9a92496662 [console] Don't overwrite tail line if same as current line
This fixes the current line object getting corrupted by the tail line
update when the buffer is filled with a single line. There are probably
more tests to write and bugs to fix :)
2022-09-17 13:56:23 +09:00
Bill Currie d13df6cd37 [console] Add failing unit test for con_buffer
I was looking through the code for Con_BufferAddText trying to figure
out what it was doing (answer: ring buffer for both text and lines) and
got suspicious about its handling of the line objects. I decided an
automated test was in order. It turns out I was right: filling the
buffer with a single long line causes the tail line to trample the
current line, setting its pointer and length to 0 when the final
character is put in the buffer.
2022-09-17 12:59:36 +09:00
Bill Currie 437e447b6b [renderer] Add a buffer print function
It handles basic cursor motion respecting \r \n \f and \t (might be a
problem for id chars), wraps at the right edge, and automatically
scrolls when the cursor tries to pass the bottom of the screen.

Clearing the buffer resets its cursor to the upper left.
2022-09-16 00:58:25 +09:00
Bill Currie c5099d30b1 [renderer] Fix access to freed memory loading fonts
QFS_LoadFile closes its file argument (this is a design error resulting
from changing QFS_LoadFile to take a file instead of a path and not
completing the update), resulting in the call to Qfilesize accessing
freed memory.
2022-09-15 14:32:16 +09:00
Bill Currie 25a14eb232 [renderer] Add a cell-based character buffer
This is intended for the built-in 8x8 bitmap characters and quake's
"conchars", but could potentially be used for any simple (non-composed
characters) mono-spaced font. Currently, the buffers can be created,
destroyed, cleared, scrolled vertically in either direction, and
rendered to the screen in a single blast.

One of the reasons for creating the buffer is to make it so scaling can
be supported in the sw renderer.
2022-09-15 14:24:33 +09:00
Bill Currie 98f773b0ed [gamecode] Expose value_string as PR_Debug_ValueString
PR_Debug_ValueString prints the value at the given offset using the
provided type to format the string. The formatted string is appended to
the provided dstring.
2022-09-15 00:30:21 +09:00
Bill Currie aa41e6c4c6 [gamecode] Expose value_string as PR_Debug_ValueString
PR_Debug_ValueString prints the value at the given offset using the
provided type to format the string. The formatted string is appended to
the provided dstring.
2022-09-14 19:23:59 +09:00
Bill Currie c771bfa58c [renderer] Correct freetype and harfbuzz lib linking
renderer_libs was in both LIBADD and DEPENDENCIES, so make was trying to
build the freetype and harfbuzz libs when building for windows.
2022-09-13 17:38:58 +09:00
Bill Currie 6ed045cd9c [audio] Ensure FLAC doesn't use dll imports
For whatever reason, building under MXE (for windows) causes FLAC to try
to use dll import references, but setting FLAC__NO_DLL before including
FLAC/export.h fixes the issue.
2022-09-13 17:13:57 +09:00
Bill Currie bf7ef354d5 [audio] Ensure FLAC doesn't use dll imports
For whatever reason, building under MXE (for windows) causes FLAC to try
to use dll import references, but setting FLAC__NO_DLL before including
FLAC/export.h fixes the issue.
2022-09-13 17:09:42 +09:00
Bill Currie 99196550d1 [renderer] Move r_font.c to correct library
Fixes the linker error in the standard build.
2022-09-12 08:43:28 +09:00
Bill Currie 71efbba628 [vulkan] Switch draw_pic to take subpic_t instead of qpic_t
While this does pull the grovelling for the subpic out to the callers,
the real problem is the excessive use of qpic_t in the internal code:
qpic_t is really just the image format in wad files, and shouldn't be
used as a generic image handle.

Cleans up more of the icky code in the font drawing functions.
2022-09-09 20:05:31 +09:00
Bill Currie 936f6d91e4 [vulkan] Use vertex queue objects for Draw
This makes working with quads, implied alpha quads, and lines much
cleaner (and gets rid of the bulk of the "eww" fixme), and will probably
make it easier to support multiple scraps and fonts, and potentially
more flexible ordering between pipelines.
2022-09-09 17:06:33 +09:00
Bill Currie a6611fc827 [gamecode] Fix a clang compile issue
Silly clang not being actually compatible :P
2022-09-09 14:59:08 +09:00
Bill Currie a76f6c812c [gamecode] Fix a clang compile issue
Silly clang not being actually compatible :P
2022-09-09 14:57:30 +09:00
Bill Currie 019b40fb81 [ruamoko] Implement %@ handing in the ruamoko runtime
-describe is sent to the object, and the returned string passed back.
There is a worry about the lifetime of the returned string as there's
currently no way of both ensuring it doesn't get freed prematurely and
ensuring it does eventually get freed.
2022-09-09 14:48:03 +09:00
Bill Currie be447fc9d6 [gamecode] Add optional support for %@ strings
If no handler has been registered, then the corresponding parameter is
printed as a pointer but with surrounding brackets (eg, [0xfc48]). This
will allow the ruamoko runtime to implement object printing.
2022-09-09 14:48:03 +09:00