Commit graph

5699 commits

Author SHA1 Message Date
Bill Currie
03e867f0f8 [ui] Remove some extra debug outlines
Forcing hidden views and doing the outlines for the screen canvas were
part of sorting out weirdnesses with canvases and component sub-pools.
2023-01-21 11:20:09 +09:00
Bill Currie
3c8f02c655 [client] Switch to using canvases for screen and hud
Canvases provide layered rendering as for each canvas all components are
rendered in turn.
2023-01-21 03:43:18 +09:00
Bill Currie
f0fab885d4 [ui] Get canvas into a usable state
Canvas_SortComponentPool now takes the raw canvas component id as it is
specialized to the canvas subpools.

Canvas_SetLen resizes the root view and then updates the hierarchy for
every canvas in the system.

Canvas_InitSys sets up the component system with the systems it needs
(canvas, view, text). This is required to ensure view_href is just past
the canvas components as it is needed for retrieving the actual canvas
component (and thus sub-pool range ids) from arbitrary views in the
canvas.

Entities are fetched with the correct offset from the pool entities.
2023-01-21 03:26:02 +09:00
Bill Currie
9384442834 [ecs] Remove a debug print 2023-01-21 03:14:27 +09:00
Bill Currie
4949f52b58 [console] Move gib hud control into hud
I don't know why it was ever in console.
2023-01-21 02:57:05 +09:00
Bill Currie
32cead5f88 [ui] Add a function to create a new canvas entity
The entity has only a canvas component and (root) view component
attached. The plan is to use it for screen-space canvases.
2023-01-20 15:57:29 +09:00
Bill Currie
873d400766 [scene] Remove scene_resources_t struct
It was made unnecessary by the ECS changes.
2023-01-20 15:53:51 +09:00
Bill Currie
68c7003991 [console] Separate loading and initialization
This will make it easy for client code to set up data needed by the
console before the console initializes. It already separates console
cvar setup and initialization, which has generally been a good thing.
2023-01-20 13:27:17 +09:00
Bill Currie
06fdef52e8 Clean up some unneeded console.h includes 2023-01-20 12:59:45 +09:00
Bill Currie
ae0b781818 [vulkan] Implement water warp
The separated output pass made the implementation very easy, as did
having most of the parts already in place.
2023-01-19 23:05:06 +09:00
Bill Currie
d7b1fceb12 [vulkan] Remove a dead FIXME
The flashing pink around the Q menu cursor was caused by vulkan command
buffer writes and draw queue population being out of phase, which was
fixed by the recent screen update changes (specifically,
42441e87d4).
2023-01-19 21:36:03 +09:00
Bill Currie
cdc5f8a912 [vulkan] Get line rendering working again
Rather important for debugging 2d stuff (draw's lines are 2d-only).
Other than translucent console, this gets the vulkan draw api back to
full operation.
2023-01-19 21:29:39 +09:00
Bill Currie
b91a76cbcc [vulkan] Get Draw_TextBox working again
This needed either more font ids to be supported, or small lump pics (up
to 32 x 32) to be loaded into the atlas. I went with both. The menus
don't use Draw_TextBox, but quakeworld's netgraph does.
2023-01-19 17:56:37 +09:00
Bill Currie
91adb6ad6c [console] Go back to using Draw_ConsoleBackground
Using Draw_FitPic was for testing.
2023-01-19 17:35:30 +09:00
Bill Currie
e332164329 [vulkan] Implement fitted pic rendering
This makes use of slice rendering to achieve the effective scaling, but
the slice data is created only when needed so pics that never use slices
don't waste 16 vertices.
2023-01-19 17:18:51 +09:00
Bill Currie
7785eebe4c [vulkan] Clean up some unnecessary interface functions
Not all the empty stubs have been removed as the core model and skin
code still needs to be cleaned up.
2023-01-19 12:58:02 +09:00
Bill Currie
9349a739db [renderer] Run particle update in renderer update
This has little effect on sw/gl/glsl, but makes it so the particle
system isn't run on the CPU (redundantly) for vulkan.
2023-01-19 12:39:26 +09:00
Bill Currie
42441e87d4 [vulkan] Create a vulkan-specific UpdateScreen
The goal is to get vulkan relying on the "renderpass" abstraction, but
this gets vulkan up and running again, and even fixes the rendering
issues (in the end, getting canvas working wasn't required, but is still
planned).
2023-01-19 11:33:49 +09:00
Bill Currie
93e5c84a20 [gui] Link against freetype and harfbuzz
Ran into the issue while testing the screen update change ("release"
build couldn't run due to broken plugins).
2023-01-19 11:11:05 +09:00
Bill Currie
07d5749a4e [renderer] Make the core of SCR_UpdateScreen dynamic
This is a bit of a hack to allow me to work on vulkan's screen update
"pipeline" without having to mess with the other renderers, since it
turns out they're (currently) fundamentally incompatible.
2023-01-19 11:10:48 +09:00
Bill Currie
d2467f1424 [vulkan] Use dynamic descriptors for dynamic verts
When a pic needs dynamic vertices (eg, for sub-pics), a descriptor set
is allocated and updated if one has not been created for the pic. This
is done each frame: the descriptor sets are recycled (there currently is
rarely a need for more than a small handful of dynamic descriptors, so
64 should be plenty for now).

Unfortunately, due to the order of operations issue between draw items
getting queued and submitting commands to vulkan (the cause of the pics
not rendering correctly per 8fff71ed4b),
the validation layers complain (correctly) about the command buffers
being executed with updated descriptor sets. Getting the canvas system
up and running will fix that.
2023-01-17 20:49:22 +09:00
Bill Currie
4e1ddaa964 [renderer] Add fitted pic rendering
The pic is scaled to fill the specified rect (then clipped to the
screen (effectively)). Done just for the console background for now, but
it will be used for slice-pics as well.

Not implemented for vulkan yet as I'm still thinking about the
descriptor management needed for the instanced rendering.

Making the conback rendering conditional gave an approximately 3% speed
boost to glsl with the GL stub (~12200fps to ~12550fps), for either
conback render method.
2023-01-17 11:33:47 +09:00
Bill Currie
96c82106f9 [sw] Remove hand loop unrolling from pic and conback
GCC has done a better job for about twenty years. Readability for the
win :).
2023-01-17 11:31:46 +09:00
Bill Currie
31c1420682 [client] Further decouple screen and console
The wording might seem a little odd, but cl_screen is really the full 2D
client HUD while the console is completely independent of the client and
shouldn't know that the client even exists. Ideally, the resize events
would be handled by the canvas system, to which end this is a small
step.
2023-01-16 13:29:20 +09:00
Bill Currie
8833518826 [ecs] Support sorting subpools
Sorting the whole pool when subpools are in use could break the
subpools (very high probability, depending on the sort criteria and
subpool criteria).
2023-01-16 11:32:12 +09:00
Bill Currie
2383c12a4a [renderer] Move r_framecount update out of render_scene
This fixes the broken dynamic lighting in fisheye rendering. It does
mean that frustum culling of lit surfaces needed to be removed, but if
not doing frustum culling on lit surfaces was good enough for a P90,
it's probably good enough for an i7-6850K.
2023-01-16 00:38:43 +09:00
Bill Currie
73e5ccd0d5 [vulkan] Set transparent color to black
I had forgotten that the draw pipeline expects pre-multiplied alpha,
thus the pink background for the menu pics.
2023-01-13 18:36:14 +09:00
Bill Currie
0953446c3e [vulkan] Load cachepics as separate images
They are usually larger images (eg, the main menu graphic) and thus make
a mess of the atlas (thus, making them separate means a smaller atlas
can be used). All sorts of things are in a mess (descriptor management,
subpic rendering not supported, wrong alpha value for the transparent
pixel), but this gets the basic loader going.
2023-01-13 11:15:44 +09:00
Bill Currie
2f564ca5a6 [vulkan] Use slices to implement fills
Again, not really the most optimal as 8/9 quads are degenerate, but it
went a long way to testing the slice part of the pipeline.
2023-01-12 17:10:43 +09:00
Bill Currie
65005656cb [vulkan] Implement tile clear
This just takes advantage of the dynamic verts for doing subpics. It's
not really the most optimal code as it has to write both the vertices
(64 bytes per quad) and the instances (24 bytes per quad), but that's
still better than the old 128 bytes per quad (and having a single
pipeline is nice).
2023-01-12 17:06:18 +09:00
Bill Currie
89ecde787a [vulkan] Use dynamic quad vertices for subpics
This gets subpics and the crosshairs working again.
2023-01-11 17:16:49 +09:00
Bill Currie
456003f8cb [vulkan] Create static vertex data for pics
This gets full pic rendering working. Subpics and other dynamic quad
rendering doesn't work yet.
2023-01-11 13:34:27 +09:00
Bill Currie
77fc6355cc [vulkan] Use correct descriptor set for core quads
The problem was that I had mixed up the purpose of the per-frame vertex
buffers and used them for the core quad data when they were meant for
subpic and the like, and forgotten about the static vertex buffer.

This gets at least conchars working (pic in general not tested yet).
2023-01-11 12:47:22 +09:00
Bill Currie
8fff71ed4b [vulkan] Rework quad drawing to use a single pipeline
Any performance gains will be utterly swamped by the deferred renderer,
but it will allow better control of quad render order by any client
code (and should be slightly better for simpler renderers when I get
support for them working).

Right now, plenty is broken (much of the higher level draw functions are
disabled, and pics don't render correctly), but this gets at least the
basics in so I'm not bouncing diffs around as much.
2023-01-11 11:34:32 +09:00
Bill Currie
c8afad4d3d [vulkan] Make QFV_PacketCopyBuffer take destination offset
It's useful being able to update a subregion of a buffer (needed for the
quad drawing changes).
2023-01-11 11:34:22 +09:00
Bill Currie
b310ece7bd [vulkan] Clean up draw a little bit
It's just removing some functions that will never be implemented, and an
unnecessary field.
2023-01-09 13:31:53 +09:00
Bill Currie
82d0b7ecd5 [vulkan] Use slice pipeline for glyphs
It turns out the slice pipeline is compatible with the glyph pipeline in
that its vertex attribute data is a superset (just the addition of the
offset attributes). While the queues have yet to be merged, this will
eventually get glyphs, sliced sprites, and general (static) quads into
the one pipeline. Although this is slightly slower for glyph rendering
(due to the need to pass an extra 8 bytes per glyph), this should be
faster for quad rendering (when done) as it will be 24 bytes per quad
instead of 32 bytes per vertex (ie, 128 bytes per quad), but this does
serve as a proof of concept for doing quads, glyphs and sprites in the
one pipeline.
2023-01-05 16:34:01 +09:00
Bill Currie
3da90b612f [vulkan] Remove superfluous glyph fragment shader
The main reason I had created in the first place was I hadn't thought of
using image view swizzles to handle coverage-alpha textures (for
monochrome glyphs), and for whatever reason also had the texture in a
different binding slot to the twod fragment shader. With both issues out
of the way, there's no reason to have an almost identical (just some
naming) shader just for glyphs.
2023-01-05 13:34:52 +09:00
Bill Currie
37b6d4da7e [vulkan] Switch glyph vertex and texture data bindings
With an eye towards merging the 2d pipelines as much as possible, I
found that the glyph and basic 2d quad texture descriptors were in
different slots for no reason I can think of. Having them in the same
slot would mean I could use the same fragment shader for all 2d
pipelines (though the plan is to get it down to two: (sliced) quads and
lines).
2023-01-05 13:25:46 +09:00
Bill Currie
70e93bb7e8 [ruamoko] Advance glyphset when working through the pool
It seems to help if the right font data is used when rendering glyphs.
Fixes use of multiple fonts in different passages.
2023-01-03 20:20:02 +09:00
Bill Currie
5477749280 [vulkan] Use correct input assembly for sprite depth
I hadn't noticed the problem until playing with early fragment tests for
the sprite fragment shaders, but passing data that expects triangle
strips to a pipeline that expects triangle lists doesn't work too well
when drawing quads.
2022-12-23 12:47:28 +09:00
Bill Currie
b5912bba9b [ui] Clean up the canvas component
It turns out only the range ids are needed in the canvas component at
this stage, and moving the canvas system base into canvas_system_t makes
sense.
2022-12-21 01:54:10 +09:00
Bill Currie
6decbd18c4 [ui] Add a canvas system
This is the beginning of supporting 2d rendering in 3d space. The idea
is that a canvas can be in 2d orthographic space (not attached to any
entity with a 3d transform), or in 3d perspective space (attached to an
entity with a 3d transform, either as a child of the camera, or of some
object in 3d space).

It will replace the current HUD code when it's working.
2022-12-20 19:45:48 +09:00
Bill Currie
3a2877dd9a [ecs] Adjust subpool range type to return start,end
I found I needed the subrange start as well as the end, but I liked that
the subpools themselves used only the end of the range, so switching to
just a unint32_t for the value and adding a function to return a tuple
made sense. I had kept the struct because I thought I might want to
store additional information (eg, the entity "owning" the subpool), but
found that I didn't need such information as the systems using subpools
that way would have access to the entity by other means.

Interestingly, the change found a bug in subpool creation: I really
don't know why things worked before, but they work better now :)
2022-12-20 17:56:08 +09:00
Bill Currie
34930ba195 [ecs] Fix a bit of white space 2022-12-20 10:59:26 +09:00
Bill Currie
d67b8cdf05 [ecs] Add support for subpools
Subpools are for grouping components by some criterion. Any component
that has a rangeid callback will be grouped with other components that
return the same render id. Note that the ordering of components within a
group will be affected by adding a component into a group that comes
before that group (or removing a component).

Component pools can have multiple groups, added and removed dynamically,
but removing a group should (currently) be done only when empty.
2022-12-18 21:11:21 +09:00
Bill Currie
24a85dbadc [ui] Add a component set for passage hierarchy refs
While "set" is a tad strong (there's just the one component for now), I
had missed the changes when adding ECS systems. Fixes the segfault at
the end of demo1 (ie, when any center text is printed).
2022-12-16 18:12:38 +09:00
Bill Currie
61f61baf48 [client] Remove hud_href component
I had missed this when adapting the ecs system for modular systems.
2022-12-15 12:50:27 +09:00
Bill Currie
41d25df0d2 [ui] Attach text views to passage entities
Instead of creating new entities for the text views. This approximately
halves the number of entities required to display flowed text, but also
tests the ability to have an entity in multiple hierarchies (the goal of
the ECS component and system changes).
2022-12-14 22:38:37 +09:00
Bill Currie
ead5e89165 [renderer] Don't mark made pics as cached
Marking them as cached means that they'll be "uncached" instead of
destroyed when freed, which would not be a particularly good thing. I
have no memory as to how I found this as I found the change in my git
stash.
2022-12-14 12:40:14 +09:00