Commit Graph

1534 Commits

Author SHA1 Message Date
Bill Currie 39103cc8a3 [sw] Fix some 32-bit assembly issues
I'm not sure that the mismatch between refdef_t and the assembly defines
was a problem (many fields unused), but the main problem was due to
execute permission on the pages: one chunk of asm was in the data
section, and the patched code was not marked as being executable (due to
such a thing not existing when quake was written).
2021-04-02 22:17:32 +09:00
Bill Currie e50a079f72 [vulkan] Fix some 32-bit compatibility issues
mostly dealing with vulkan's handles always being 64-bit, but pointers
being either 32 or 64.
2021-04-02 08:48:11 +09:00
Bill Currie 612eb49d9c [render] Separate fov x and y calculations
This ensures that fov_y is not calculated until after the render view
size is known and thus doesn't become some crazy angle (that happens to
result in a negative tan). Fixes upside-down-quake :)
2021-04-01 19:40:25 +09:00
Bill Currie 37d35811e3 [vid,render] Clean up fov and aspect
vid.aspect is removed (for now) as it was not really the right idea (I
really didn't know what I was doing at the time). Nicely, this *almost*
fixes the fov bug on fresh installs: the view is now properly
upside-down rather than just flipped vertically (ie, it's now rotated
180 degrees).
2021-04-01 19:17:19 +09:00
Bill Currie f13af65b32 [vulkan] Move viewport and scissor into vulkan_ctx
Not only does it makes sense to centralize the setting of viewport and
scissor, but it's actually necessary in order to fix the upside-down
rendering on windows.
2021-04-01 11:44:30 +09:00
Bill Currie 63e30e6ae0 [win] Fix a handful of small bugs for windows
Only 64-bit windows is tested, and there are still various failures, but
QF is limping along in windows again.

nq-sdl works for sw, and sw32, gl and glsl are mostly black (but not
entirely for gl?),  vulkan is not supported with sdl.

nq-win works for sw and sw32, and sort of for vulkan (very dark and
upside-down?). gl and glsl complain about vid mode,

qw-client-[sdl,win] seem to be the same, but something is wrong with the
console (reading keyboard input).
2021-03-30 20:19:20 +09:00
Bill Currie ae78c81b3a [render] Fail gracefully on unsupported render targets
Ideally, this won't be the case, but it currently is for Vulkan and SDL.
2021-03-30 18:29:18 +09:00
Bill Currie 5f93c115ff [util] Make developer flag names easier to manage
They're now an enum, and the flag part of the name is all lowercase, but
now the flag definitions and names list will never get out of sync.
2021-03-29 22:38:47 +09:00
Bill Currie 64f51bda6e [build] Get make distcheck working again
again...

This covers only the basic check with a build in debian, but it's a good
start.
2021-03-29 17:35:30 +09:00
Bill Currie 6fea5f5e1a [build] Add -Wformat-non-literal option
While this caused some trouble for pr_strings and configurable strftime
(evil hacks abound), it's the result of discovering an ancient (from
maybe as early as 2004, definitely before 2012) bug in qwaq's printing
that somehow got past months of trial-by-fire testing (origin understood
thanks to the warning finding it).
2021-03-29 17:27:06 +09:00
Bill Currie 88ff254f42 Get QF cross-compiling using MXE/mingw32
This includes -win clients (no clue if anything actually works yet).
2021-03-27 20:09:37 +09:00
Bill Currie 5b1ee0e6f6 [vulkan] Fix an inappropriate cast
I'm surprised that worked at all (and more surprised it got past linux
gcc).
2021-03-27 19:55:43 +09:00
Bill Currie a9bd436837 [build] Autoconfiscate printf format attribute
I don't know if gnu_printf is appropriate for all cases, but it is
needed for mingw32.
2021-03-27 19:52:59 +09:00
Bill Currie a32e2319e2 Merge branch 'master' into win-merge 2021-03-25 22:42:16 +09:00
Bill Currie c9f1d770e0 Merge master into csqc-improvements
That was a mess
2021-03-25 22:01:31 +09:00
Bill Currie 67c220de76 Make R_SetVrect const-correct. 2021-03-25 18:14:17 +09:00
Bill Currie 91e3769c05 Recalculate the fov when the cvar changes.
This separate the FOV calculations from other refdef calcs, cleaning up the
renderer proper and making it easier for other parts of the engine (eg,
csqc) to update the fov.
2021-03-25 18:14:03 +09:00
Bill Currie 32c2e013ca [vulkan] Add missed screen capture files
Rather critical to the build (and screenshots)
2021-03-25 16:00:19 +09:00
Bill Currie 999dd8248b [vulkan] Implement sky box loading and rendering
Loading is broken for multi-file image sets due to the way images are
loaded (this needs some thought for making it effecient), but the
Blender environment map loading works.
2021-03-25 15:54:34 +09:00
Bill Currie c5c44da727 [vulkan] Implement screenshot
Finally, I can brag about my progress on irc :)
2021-03-24 19:20:53 +09:00
Bill Currie 51d6ec7c8c [vulkan] Fix what looks like a thinko
It looked like the code would have deleted a replacement swapchain
instead of the one being replaced.
2021-03-24 12:04:09 +09:00
Bill Currie a0d47de439 [vulkan] Suppress all the debug output
silence is golden
2021-03-23 13:04:22 +09:00
Bill Currie 7e946a4de9 [vulkan] Implement water surface rendering
They're unlit (fullbright, but that's nothing new for quake), but
working nicely. As a bonus, sort out the sky pass (forced to due to the
way command buffers are used).
2021-03-23 12:24:24 +09:00
Bill Currie 6e0312658d [vulkan] Fix sky depth issues
There were actually several problems: translucency wasn't using or
depending on the depth buffer, and the depth buffer wasn't marked as
read-only in the g-buffer pass. Getting that correct seems to have given
bigass1 a 0.5% boost (hard to say, could be the usual noise).
2021-03-23 11:26:24 +09:00
Bill Currie 5ac807d4b2 [vulkan] Remove the old forward renderpass spec
I doubt I'll go back to it, and it was in the wrong place anyway.
2021-03-23 10:12:26 +09:00
Bill Currie d4e1bfb8b8 [vulkan] Clean up the pipeline specifications
While being able to write pipeline specs like this was the end goal of
the parsing sub-project, I didn't realize it was already usable. This
sure makes going through the pipeline specs much easier.
2021-03-23 10:01:13 +09:00
Bill Currie 81956095f1 [vulkan] Use correct vertex shader for skys
This gets skys rendering again, but their depth is incorrect.
2021-03-23 08:25:56 +09:00
Bill Currie de581501fb [vulkan] Early out from lights that are too distant
Gives a 43% speed boost to bigass1 timedemo (366 -> 525 fps).
2021-03-22 20:33:42 +09:00
Bill Currie 4eecbe867d [vulkan] Implement deferred emission (fullbrights)
That was... easier than expected. A little more tedious that I would
have liked, but my scripting system isn't perfect (I suspect it's best
suited as the output of a code generator), and the C side could do with
a little more automation.
2021-03-22 19:08:16 +09:00
Bill Currie 5173414d97 [vulkan] Implement light styles
Other than dealing with shader data alignment issues, that went well :).
Nicely, the implementation gets the explicit scaling out of the shader,
and allows for a directional flag.
2021-03-22 13:13:26 +09:00
Bill Currie 56cf181a11 [gamecode] Make PR_RESMAP macros more function-like
I never liked that some of the macros needed the type as a parameter
(yay typeof and __auto_type) or those that returned a value hid the
return statement so they couldn't be used in assignments.
2021-03-21 21:26:36 +09:00
Bill Currie cc4167668c Fix a pile of leaks and uninit errors
Still "some" more to go: a pile to do with transforms and temporary
entities, and a nasty one with host_cbuf. There's also all the static
block-alloc lists :/
2021-03-21 19:56:17 +09:00
Bill Currie a3c1b2e992 [util] Rename qfplist.[ch]
The name is a hold-over from before the current quakeforge tree and the
QF include directory.
2021-03-21 16:13:03 +09:00
Bill Currie 66e6627780 [vulkan] Use the correct character data
I got tired of not being able to read 90% of quake's output :P
2021-03-21 11:37:36 +09:00
Bill Currie 0a79348ce9 [vulkan] Tweak the lighting to look a bit better
Reduced the gamma correction a bit and increased the intensity of
dynamic lights. Not sure the latter is correct, but it looks much
better.
2021-03-20 19:15:06 +09:00
Bill Currie cadea27577 [vulkan] Disable lightmap support
Hopefully, it won't be needed.
2021-03-20 18:02:27 +09:00
Bill Currie 0246e55983 [vulkan] Support colored lights
Now my dizzy map looks like it used to (more or less, possibly too dark,
but I suspect I used some command-line settings to qflight).
2021-03-20 16:50:37 +09:00
Bill Currie dccd6989b2 [vulkan] Implement gamma correction
Currently hard-coded to 0.67 (1/1.5), but it does the job for now.
2021-03-20 16:50:11 +09:00
Bill Currie bab3e0720f [vulkan] Implement real-time lighting
Light styles and shadows aren't implemented yet.

The map's entities are used to create the lights, and the PVS used to
determine which lights might be visible (ie, the surfaces they light).
That could do with some more improvements (eg, checking if a leaf is
outside a spotlight's cone), but the concept seems to work.
2021-03-20 16:08:44 +09:00
Bill Currie 8f7d6b1d02 [vulkan] Initialize skins
This allows the qw client to run with Vulkan.
2021-03-20 00:08:21 +09:00
Bill Currie 5bf21931c7 [renderer] Remove more old fields from entity_t
The only transform related field remaining is old_origin. This also
brings the renderer closer to using simd (lots of stuff to fix still,
though).
2021-03-20 00:08:21 +09:00
Bill Currie 5158cc5527 [util] Add normal and magnitude float vector functions 2021-03-19 11:09:57 +09:00
Bill Currie 2015474468 Move and clean up clview.h
Redundant or dead prototypes deleted, and the client/view.h seems a good
place for the file.
2021-03-12 11:48:53 +09:00
Bill Currie abaccbec53 [client] Move qw's loc code into client
This makes the location code available to nq (not used yet) but more
importantly moves some definitely client-side code into the right place.
2021-03-11 11:53:38 +09:00
Bill Currie c05a15dec5 [glsl] Use vec4f_t in a few more places
No idea if it makes a noticeable speed difference, but it makes a huge
readability difference.
2021-03-10 21:17:34 +09:00
Bill Currie 169e0192f2 [gl] Use the correct value for sqrt(0.5)
707106781 looks right, but isn't quite.
2021-03-10 19:06:15 +09:00
Bill Currie 56d84ef63e [gl] Fix the compressed sprites
Seems to be an ancient bug.
2021-03-10 18:35:35 +09:00
Bill Currie fbc1bd9f6e [renderer] Clean up entity_t to a certain extent
This is the first step towards component-based entities.

There's still some transform-related stuff in the struct that needs to
be moved, but it's all entirely client related (rather than renderer)
and will probably go into a "client" component. Also, the current
components are directly included structs rather than references as I
didn't want to deal with the object management at this stage.

As part of the process (because transforms use simd) this also starts
the process of moving QF to using simd for vectors and matrices. There's
now a mess of simd and sisd code mixed together, but it works
surprisingly well together.
2021-03-10 00:01:41 +09:00
Bill Currie 2c5742a076 [renderer] Remove some variable warts
Ugh, Hungarian notation is still lurking...
2021-03-09 11:37:47 +09:00
Bill Currie 0366b72d4a [vulkan] remove the fps printing
Now that pixels are rendered, there's no need to print the fps
separately as the in-game display works quite nicely.
2021-03-03 18:16:27 +09:00
Bill Currie 4d8ce22c17 [vulkan] Load the map's lights into an array
It's not used yet as work needs to be done to better support generic
entities, but this is the next step to real-time lighting (though, to be
honest, I expect it will be too slow to be usable).
2021-03-03 18:14:16 +09:00
Bill Currie eb0aa2dcea [renderer] Clean up most globals in efrags
There's still the memory management itself to clean up, but the main
code no longer uses any static/global variables (holdover from when the
function was recursive rather).
2021-03-03 16:34:16 +09:00
Bill Currie 9617bbef97 [build] Create static libs for render targets
The static libs are used to build the plugins, but make it easy to use
only those modules needed for tests. Fixes the link error when running
"make check" with non-static plugins.
2021-03-03 16:34:16 +09:00
Bill Currie fd97bb1456 [vulkan] Implement linear falloff
It's possibly too bright, but it might be the lights themselves. Still,
it looks better than the no-falloff implementation.
2021-02-25 16:11:47 +09:00
Bill Currie 33575f93d5 [vulkan] Implement deferred lighting for dlights
Static lights are yet to come (so the screen is black most of the time),
but dynamic lights work very nicely (and look very good) despite the
falloff being incorrect.
2021-02-25 15:51:54 +09:00
Bill Currie 918c3af095 [vulkan] Add a position buffer to the g-buffer
While I could reconstruct the position from the screen coords and depth,
this is easier and good enough for now. Reconstruction is an
optimization thing.
2021-02-25 13:46:33 +09:00
Bill Currie 6c1d6666b4 [vulkan] Actually write the alias g-buffer commands
It seems to help for some reason.
2021-02-24 20:24:46 +09:00
Bill Currie 10a1b99a92 [vulkan] Implement lighting and compose passes
Lighting doesn't actually do lights yet, but it's producing pixels.
Translucent seems to be working (2d draw uses it), and compose seems to
be working.
2021-02-24 19:58:31 +09:00
Bill Currie 9229b67633 [vulkan] Clean up the new render pass and framebuffers 2021-02-24 16:27:56 +09:00
Bill Currie e6ecf5e855 [vulkan] Fix up commands for deferred rendering
Nothing gets output yet (lighting and composite passes not implemented),
but everything passes validation until exit (not destroying everything).
2021-02-23 15:43:02 +09:00
Bill Currie 82eabb5ca2 [vulkan] Parse clear values
And get the render pass working in general. Note that this is only the
render pass and frame buffers: actual commands still have problems.
2021-02-23 14:37:48 +09:00
Bill Currie cbc8ad271a [vulkan] Convert bsp and draw to deferred
This has bsp and draw passing muster with the validation layers.
2021-02-19 11:14:54 +09:00
Bill Currie 4245c6ad3b [vulkan] Specify subpass number in pipeline def
This gets the alias model render pass and pipeline passing validation.

I don't know why I didn't add the subpass field to the
VkGraphicsPipelineCreateInfo parser def, though it could be I simply
missed it, or I thought I wouldn't need it at the time.
2021-02-17 13:50:36 +09:00
Bill Currie 64740b0f73 [vulkan] Create shaders for alias deferred rendering
A simple (no uv output) vertex shader that still blends the two frames,
and the relevant g-buffer fragment shader.
2021-02-17 13:35:19 +09:00
Bill Currie b08c3881b9 [vulkan] Add a comment about using size_t
Due to wanting to access array sizes when parsing uint32_t type values,
parse_uint32_t needs to handle size_t values even though it throws out
any excess bits.
2021-02-17 13:32:04 +09:00
Bill Currie a94949c009 [vulkan] Start moving towards a deferred renderer
After getting lights even vaguely working for alias models, I realized
that it just wasn't going to be feasible to do nice lighting with
forward rendering. This gets the bulk of the work done for deferred
rendering, but still need to sort out the shaders before any real
testing can be done.
2021-02-14 11:35:06 +09:00
Bill Currie 121425a75b [vulkan] Allow all struct objects to be referenced 2021-02-14 11:32:57 +09:00
Bill Currie cffd48434c [vulkan] Move the shaders into their own directory 2021-02-10 17:43:11 +09:00
Bill Currie 14e4fd9f6a [util] Pass context to the plist array/symtab parser allocator 2021-02-09 15:01:55 +09:00
Bill Currie dfa7af03c6 [util] Plug a thread-safety hole in plists 2021-02-09 09:57:07 +09:00
Bill Currie 84dc73da2c [test] Get the tests building again
They happen to all pass, which is nice :)
2021-02-05 21:43:12 +09:00
Bill Currie f023675f8c [vulkan] Clean up draw's memory handling a little
Use cmem for pic and cachpic name allocations. If nothing else, it at
least keeps memory a little less fragmented.
2021-02-05 16:25:08 +09:00
Bill Currie c536a363ec [vulkan] Remove namehack.h
Never really wanted in the first place (back when I did the plugin
renderers), but I didn't feel like doing the required work to avoid it
at the time. At least with Vulkan being a fresh start in an environment
that's already plugin-friendly, there was no real work involved. I'll
get to the other renderers eventually (especially now that I know gdb
does the right thing when there are multiple functions with the same
name).
2021-02-05 11:10:43 +09:00
Bill Currie f633a846a1 [vulkan] Make the frames in flight configurable 2021-02-05 11:06:18 +09:00
Bill Currie 1275067655 [vulkan] Rename vulkan_framebuffer_t
It turns out I had conflated frame buffers with frames and wound up
making a minor mess when separating the number of frames the renderer
could have in flight from the number of swap-chain images. This is the
first step towards correcting that mistake.
2021-02-05 10:22:32 +09:00
Bill Currie 7ffe197564 [vulkan] Remove some dead code
I forgot to delete that block of code after getting the new code working.
2021-02-05 10:19:57 +09:00
Bill Currie e929dca300 [util] Auto-cast plist string items
The casting uses a recursive call to the expression parser, so the
expressions are type-checked automatically.
2021-02-04 22:37:20 +09:00
Bill Currie a54de63fee [vulkan] Take care of the duplicate handles 2021-02-04 20:40:28 +09:00
Bill Currie 8179c44042 [vulkan] Rework pipeline parsing for better reuse
It's not entirely there yet, but the basics are working. Work is still
needed for avoiding duplication of objects (different threads will have
different contexts and thus different tables, so necessary per-thread
duplication should not become a problem) and general access to arbitrary
fields (mostly just parsing the strings)
2021-02-04 17:03:49 +09:00
Bill Currie bc7858bb87 [model] Move parent pointer out of leaf/node struct
The node struct was 72 bytes thus two cache line. Moving the pointer
into the brush model data block allows nodes to fit in a single cache
line (not that they're aligned yet, but that's next). It doesn't seem to
have made any difference to performance (at least in the vulkan
renderer), but it hasn't hurt, either, as the only place that needed the
parent pointer was R_MarkLeaves.
2021-02-03 11:41:38 +09:00
Bill Currie ebb73e19b2 [vulkan] Use the msaaSamples cvar
That took a bit of fiddling with the render pass to get things working
for both sampling and no sampling (ie, msaaSamples = 1).
2021-02-03 00:08:33 +09:00
Bill Currie d6b678ac78 [vulkan] Implement team colors
It's not quite as expected, but that may be due to one of msaa, the 0-15
range in the palette not being all the way to white, the color gradients
being not quite linear (haven't checked yet) or some combination of the
above. However, it's that what should be yellow is more green. At least
the zombies are no longer white and the ogres don't look like they're
wearing skeleton suits.
2021-02-02 19:53:36 +09:00
Bill Currie 8e63ab9f94 [vulkan] Use 4 layer arrays for alias skins
Doesn't seem to make much difference performance-wise, but speed does
seem to be fill-rate limited due to the 8x msaa. Still, it does mean
fewer bindings to worry about.
2021-02-02 00:11:47 +09:00
Bill Currie 0d4ca46923 [vulkan] Move mip map generation commands to image 2021-02-02 00:04:45 +09:00
Bill Currie ea72d0c60e [model] Clean up the globals for alias models 2021-02-01 21:11:45 +09:00
Bill Currie 34dc7cf2df [models] Move brush data into its own struct
This is a big step towards a cleaner api. The struct reference in
model_t really should be a pointer, but bsp submodel(?) loading messed
that up, though that's just a matter of taking more care in the loading
code. It seems sensible to make that a separate step.
2021-02-01 19:31:11 +09:00
Bill Currie bb6c6963d2 [model] Clean up the globals around model loading
Covers only the generic load code (alias etc to follow), but this should
take care of a lot of issues in the future.
2021-02-01 14:39:00 +09:00
Bill Currie afe8e9633e [vulkan] Silence the matrix dump
It got annoying and has served its purpose. However, the code is still
there (#if 0) in case it's needed again.
2021-02-01 12:24:27 +09:00
Bill Currie c7eafd9254 [vulkan] Make the mip map generation public
I've decided that alias model skins should be in a single four-level
array texture rather than spread over four textures, but there's no way
I want to write that code again: getting it right was hard enough the
first time :P
2021-02-01 12:16:05 +09:00
Bill Currie eeda04e3c9 [vulkan] Name most resources
This makes debugging with renderdoc and validation messages much easier
(no more "what buffer is that?").
2021-01-31 19:58:55 +09:00
Bill Currie 7970525ef4 [util] Make va thread-safe
It now takes a context pointer (opaque data) that holds the buffers it
uses for the temporary strings. If the context pointer is null, a static
context is used (making those uses of va NOT thread-safe). Most calls to
va use the static context, but all such calls have been formatted
consistently so they are easy to find when it comes time to do a full
audit.
2021-01-31 16:05:48 +09:00
Bill Currie 7ee02f3965 [vulkan] Sort of implement ambient lighting
It works, but as it uses the camera position rather than the lit
entity's position, it is incorrect. I have some interim ideas to handle
it, though.
2021-01-28 19:17:40 +09:00
Bill Currie 206c631811 [vulkan] Get alias lighting mostly working
It's not so much that parts aren't working, but rather there's no
base-level lighting so everything is black until a dlight is in the
vicinity
2021-01-28 15:20:24 +09:00
Bill Currie 28652c4d59 [vulkan] Implement alias model texturing
I had messed up my index array creation, but once that was fixed the
textures worked well other than a lot of pixels are shades of grey due
to being in the top or bottom color map range.
2021-01-28 14:14:21 +09:00
Bill Currie 64904e2b27 [vulkan] Switch over to pushed descriptors
I don't really know why (I need to do some research), but this fixes the
lockups when accessing the matrices UBO. It has made a mess of my
carefully designed uniform binding layout, so I hope I can get bound
descriptor sets working the way I want, but I really need to progress on
the rest of the project.
2021-01-28 10:49:23 +09:00
Bill Currie caa7623a35 [vulkan] Clean up alias light buffer
Still wedging, but it seems to be something to do with the matrix
buffer.
2021-01-27 17:59:09 +09:00
Bill Currie 9f64416846 [vulkan] Create the lights buffer
It's a tad bogus as it's the lights close to the camera, but it should
at least be a good start once things are working. There's currently
something very wrong with the state of things.
2021-01-27 16:16:28 +09:00
Bill Currie a64f477796 [vulkan] Get alias texture loading working
That was a mess, partly premature optimizations, and some silly
mistakes.
2021-01-27 12:15:45 +09:00
Bill Currie 748217b438 [vulkan] Start work on alias model rendering 2021-01-26 20:58:24 +09:00
Bill Currie 56573d09e4 [vulkan] Get Vulkan_LoadTex working
Finally managed to actually use and thus sort out its issues.
2021-01-26 13:46:04 +09:00
Bill Currie 57968249fe [vulkan] Start work on the alias pipeline 2021-01-26 10:20:50 +09:00
Bill Currie 7a19be7265 [image] Change tex_t data from array to pointer
This makes tex_t more generally useable and probably more portable. The
goal was to be able to use tex_t with data that is in a separate chunk
of memory.
2021-01-25 00:54:41 +09:00
Bill Currie af5415010a [vulkan] Clamp the conback lines to the texture height
Fixes the bad background (with deadbeef scrap)
2021-01-24 00:54:26 +09:00
Bill Currie ada4f37b9d [vulkan] Fix the over-bright dynamic lights
I doubt they're anywhere near right, but they're much better. At least
they're not just solid blocks of white.
2021-01-24 00:26:38 +09:00
Bill Currie 3132aa91a8 [vulkan] Get sky sheets working
The sky texture is loaded with black's alpha set to 0. While this does
hit both layers, the screen is cleared to black so it shouldn't be a
problem (and will allow having a skybox behind the sheets).
2021-01-23 23:58:34 +09:00
Bill Currie 49408c695d [vulkan] Get sky sheets mostly working
They render (incorrectly because the images weren't translated
correctly), but aren't animated (haven't pushed the time constant)
2021-01-23 22:51:59 +09:00
Bill Currie 77a8f90113 [vulkan] Fix array parsing size error
The size was not getting written if it was the first value in the
structure.
2021-01-23 20:40:11 +09:00
Bill Currie 4283d690ad [vulkan] Generate correct parse data for size_t
Fixes a segfault when parsing specialization map data.
2021-01-23 20:39:09 +09:00
Bill Currie 93e9f89bd3 [vulkan] Create some default textures
Black, white and magenta. This gets glow (full bright) maps working.
2021-01-23 15:40:31 +09:00
Bill Currie 68b7341429 [vulkan] Set main texture image view
Glow map and sky sheet and cube need to wait until I can get some
default textures going, but the world is rendering correctly otherwise
(though a tad dark: need to do a gamma setting).
2021-01-23 13:51:09 +09:00
Bill Currie c989c8a6b6 [vulkan] Rewrite staging buffer packet handling
It now uses the ring buffer code I wrote for qwaq (and forgot about,
oops) to handle the packets themselves, and the logic for allocating and
freeing space from the buffer is a bit simpler and seems to be more
reliable. The automated test is a bit of a joke now, though, but coming
up with good tests for it... However, nq now cycles through the demos
without obvious issue under the same conditions that caused the light
map update code to segfault.
2021-01-23 12:01:52 +09:00
Bill Currie c016ad9f55 [vulkan] Ignore light map alpha
Needed to use an rgba format to use floats (and optimal layout), but
having to set the alpha to 1 even for full-dark luxels is not very
efficient. Better to just ignore the alpha in the shader. Fixes the
occasional transparent surface in shadowed areas.
2021-01-22 13:08:33 +09:00
Bill Currie 55badea1ae [vulkan] Reset model transform for world surfaces
Fixes the misplaced walls.
2021-01-22 02:42:58 +09:00
Bill Currie c75568c1cf [vulkan] Get wall rendering partially working
Many surfaces are missing (I suspect it's due to transform stage
management in the index emitter), and currently only the light maps are
rendered (still not binding the correct textures), but the basics are
working.
2021-01-22 02:20:32 +09:00
Bill Currie 7e7b82086c [vulkan] Round up the staging buffer size
Vulkan validation (quite rightly) doesn't like it when the flush range
goes past the end of the buffer, but also doesn't like it when the flush
range isn't cache-line aligned, so align the size of the buffer, too.
2021-01-22 02:18:39 +09:00
Bill Currie 2acdaa0252 [vulkan] Fix a pile of data upload issues
Copying data from the wrong buffer was the cause of the corrupted brush
model vertices, and then lots of little errors (mostly forgetting to
multiply by bpp) for textures.
2021-01-21 21:24:54 +09:00
Bill Currie dc79a8a935 [vulkan] Clear scrap image on creation
And fix the transitions in ScrapFlush.
2021-01-21 21:24:19 +09:00
Bill Currie 94b589567b [vulkan] Rename texture.c to scrap.c
I had originally planned on mixing the stage management with general
texture support code like I did in glsl, but I think that was a mistake
and I did keep looking for scrap.[ch] when I wanted to edit something to
do with the scrap...
2021-01-21 16:44:07 +09:00
Bill Currie eb9807576d [vulkan] Fix the bsp vertex index list creation
There's still a problem with the vertex data itself not getting sent to
the GPU properly, but vulkan is now happy with my tiny test map (which
required disabling skies entirely until I get null textures working).
2021-01-21 14:37:39 +09:00
Bill Currie 2c1a335715 [vulkan] Use vkCmdPushDescriptorSetKHR for bsp
This makes switching textures on the fly much easier.
2021-01-21 12:39:08 +09:00
Bill Currie 9e03096da6 [vulkan] Build brush model display lists
Not working particularly well yet, but no errors out of validation.
2021-01-21 02:13:40 +09:00
Bill Currie e0e6677bd3 [vulkan] Upload brush model textures
Things aren't quite right with them (sky texture is very wrong), but the
heavy lifting is done.
2021-01-21 00:40:22 +09:00
Bill Currie 1080c89a26 [vulkan] Bind the bsp main pipeline
No drawing commands are issued yet, but vulkan seems to be happy with
the state.
2021-01-20 16:51:35 +09:00
Bill Currie 9ebecf08bb [vulkan] Create a populate the vertex buffer
And create/map the index buffer.
2021-01-20 16:28:04 +09:00
Bill Currie 6f73a7388b [vulkan] Ensure staging buffer is idle before free
I never actually tested what would happen, but I suspect destroying a
staging buffer before it is finished its job would lead to unpleasant
issues.
2021-01-20 16:25:26 +09:00
Bill Currie 9eef805b7d [vulkan] Generate triangle fans for bsp models
They're not uploaded to the card yet, but the basics seem to be working.
2021-01-20 15:11:50 +09:00
Bill Currie d33f5b8d0d [vulkan] Make a lot of progress for brush models
Light maps are maybe updating, but as nothing is actually rendered yet,
it's hard to tell.
2021-01-20 01:28:54 +09:00
Bill Currie df82cb88ee [vulkan] Make some little cleanups 2021-01-20 01:23:24 +09:00
Bill Currie 2de1c02f61 [image] Add support for float rgba for vulkan 2021-01-20 01:18:47 +09:00
Bill Currie 0f81432090 [model] Load bsp textures into vulkan
The textures for an entire model are loaded into a single memory object
with shared between multiple images.
2021-01-20 00:37:37 +09:00
Bill Currie 7a353d5aee [model] Build vulkan model libs
The contents are currently empty (required .c files), but this gets the
build system updated.
2021-01-19 14:12:49 +09:00
Bill Currie 6e0cb7b917 [model] Isolate renderer specific texture data
This cleans up texture_t and possibly even improves locality of
reference when running through texture chains (not profiled, and not
actually the goal).
2021-01-19 13:07:31 +09:00
Bill Currie 40fc9f0000 [model] Make Mod_LoadExternalTextures private
It never really needed to be externally accessible as it has always been
gl-specific and can be called by Mod_ProcessTexture anyway.
2021-01-19 12:56:05 +09:00
Bill Currie e50430e00c [image] Add parameter to load only the header
I want to be able to calculate texture sizes without actually loading
the images.
2021-01-19 10:15:57 +09:00
Bill Currie 9b53d7d4e2 [model] Remove empty brush model functions
It seems better to check for a null pointer and just not call.
2021-01-19 08:26:53 +09:00
Bill Currie c7b2843c0e [vulkan] Create shanders for brush models
The fragment shader is a bit of a mini mega-shader, but I do want to try
out specializations.
2021-01-18 17:13:52 +09:00
Bill Currie dacda50130 [renderer] Stub out all the vulkan functions
nq-x11 now gets through all three demos without crashing (but without
rendering anything useful, though).
2021-01-18 12:46:06 +09:00
Bill Currie abd3b90004 [vulkan] Implement basic quake texture loading
It optionally generates mipmaps, and supports the main texture types
(especially for texture packs), including palettes, but is otherwise
rather unsophisticated code. Needs a lot of work, but testing first.
2021-01-18 02:10:56 +09:00
Bill Currie aa7ff9d618 [vulkan] Implement console background drawing
That went better than expected after deciding to put the conback in the
scrap.
2021-01-18 02:10:10 +09:00
Bill Currie 1e163fd2d7 [vulkan] Correct QFV_CreateImage samples type
Not sure why I though FlagBits was correct instead of Flags.
2021-01-18 02:08:55 +09:00
Bill Currie debaffcb97 [vulkan] Retain handle_keys item
Ugh, need to come up with valgrind for ruamoko :P
2021-01-17 22:26:48 +09:00
Bill Currie 8078e10ea1 [vulkan] Make frame-buffers independent of swapchain
This is more correct as the environment (X11 etc) might provide more
swapchain images than we want: 3 frames in flight is generally
considered a good balance between saturating the hardware and latency.
2021-01-16 21:24:42 +09:00
Bill Currie fd8521da76 [vulkan] Make frame-buffer count available to
It turns out I made a bit of a mistake in tying the frame-buffer count
to the number of swapchain images. This is the first step in sorting
that out.
2021-01-16 21:03:36 +09:00
Bill Currie 7282d2adde [vulkan] Make renderpass dependencies more explicit
Doesn't seem to adversely affect anything and is more correct from what
I can tell reading some other documentation.
2021-01-16 20:28:32 +09:00
Bill Currie f3695ec3dd [vulkan] Use the previously existing tex_t formats
I'd forgotten we had these (though direct GL_* was used).
2021-01-16 15:39:36 +09:00
Bill Currie 0150fc0487 [vulkan] Use pipeline barriers for index buffer
And set the usage correctly.
2021-01-16 15:09:39 +09:00
Bill Currie 5186d3ae49 [vulkan] Rework draw to use a context struct
Cleans up global space and makes it usable in multiple contexts. Also,
max quads dropped to 32k as each frame now has its own vertex buffer to
avoid issues with vertex overwrites (which I have seen). However, all
vertex buffers are in the one memory/buffer object (using offsets) and
the index buffer has been moved into a device-local memory object.
2021-01-16 14:42:25 +09:00
Bill Currie 904a91c0b7 [vulkan] Use only one global staging buffer
I think I did two as a bit of a ring buffer, but the new ring buffer
system used inside a staging buffer makes it less necessary. Also, the
staging buffer is now a fair bit bigger (4M is probably not really
enough)
2021-01-16 14:37:16 +09:00
Bill Currie 92afe9f265 [vulkan] Convert stagebuf to a ring buffer
I should have known this would be necessary, but it fixes the corruption
when updating the scrap.
2021-01-15 22:50:04 +09:00
Bill Currie ad9c3193fa [vulkan] Use darray size to control cmd buffer count
This allows the array in which the command buffers are allocated to be
allocated on the stack using alloca and thus remove the need to
malloc/free of relatively small chunks.
2021-01-15 22:45:49 +09:00
Bill Currie cef81741eb [vulkan] Implement most of the 2D renderer
The console background is missing, and scaled vs unscaled (currently
always scaled) 2d, but otherwise everything seems to work. Lots of
places to clean up, though.
2021-01-14 00:44:34 +09:00
Bill Currie 41b3661869 [vulkan] Use the scrap for draw
Draw now has its own staging buffer to use with its scrap. Also, a few
fixes were needed for the staging buffer and scrap flush routines.

Other than some synchronization issues with draw scrap flushing
(currently worked around with a fence-wait) things seem to be working
nicely.
2021-01-13 15:28:56 +09:00
Bill Currie a7ac188d1d [vulkan] Use a scrap texture for draw
The scrap texture did very good things for the glsl renderer and the
better control over data copying might help it do even better things for
vulkan, especially with lots of little icons.
2021-01-13 10:43:23 +09:00
Bill Currie b6bc8ed553 [renderer] Move core of scrap into shared code
The actual 2d area management code is now shared, with the actual
definition for scrap_t being left to the renderer specific
implementation.
2021-01-13 02:47:07 +09:00
Bill Currie bfbfd7af61 [glsl] Remove subpic_t's tnum
It's never actually used (the texture can be fetched using
GLSL_ScrapTexture) and gets in the way of sharing the scrap system with
the vulkan renderer.
2021-01-12 18:45:44 +09:00
Bill Currie 858ac19327 [renderer] Move r_screen and r_cvar into main bin
r_screen because of SCR_UpdateScreen, and r_cvar because the cvars
really should never have been in a plugin in the first place (and
r_screen needed access).
2021-01-12 16:14:46 +09:00
Bill Currie 93aa038d9e [vulkan] Generate handle get functions
Cleans up (hides) the casting when fetching a handle.
2021-01-12 14:56:02 +09:00
Bill Currie 8a85b5c610 [vulkan] Switch to float/normalized for pics
It gives better results when pics are squished or expanded.
2021-01-12 13:51:41 +09:00
Bill Currie 03f614ccb9 [vulkan] Parse VkBool32 correctly as bool type
This makes it much clearer whether something is just a flag or an index
of some sort.
2021-01-12 13:07:51 +09:00
Bill Currie bb4ca7683e [vulkan] Get the 2D pipeline up and running
First pixels! This was a nightmare of little issues that the validation
layers couldn't help with: incorrect input assembly, incorrect vertex
attribute specs. Though the layers did help with getting the queues
working. Still, lots of work to go but this is a major breakthrough as
I now have access to visual debugging for textures and the like.
2021-01-12 11:27:41 +09:00
Bill Currie 8f6f32981c [vulkan] Add some matrix buffers
It seems they could all be in the one buffer: there are indications that
uniform binding can be fairly fine-grained. I need to investigate that.
2021-01-12 11:26:20 +09:00
Bill Currie bf4613acd5 [vulkan] Remove missed preinitialized stages 2021-01-12 10:43:05 +09:00
Bill Currie 6e636a27d0 [renderer] Continue the job of merging SCR_UpdateScreen
I think this is probably as merged as it will get (though the update
callbacks can probably do with some merging).
2021-01-11 16:57:31 +09:00
Bill Currie 88d48944cb [vulkan] Upload the default character set
Nothing's shown yet, and the code is a tad messy, but it's serving as a
proof of concept for now.
2021-01-11 01:27:40 +09:00
Bill Currie b584d6f403 [vulkan] Abandon image "preinitialized" layout
Turn's out it's not useful for transfers. I might bring it back when I
figure out how to use it.
2021-01-11 01:25:55 +09:00
Bill Currie 23db917ec4 [vulkan] Create a staging buffer struct
And move the barrier prefabs into a more convenient place.
2021-01-11 01:24:15 +09:00
Bill Currie ba6450d0b4 [vulkan] Make a start on the 2D pipeline
Short wrappers for Draw functins are in vid_render_vulkan.c so the
vulkan context can be passed on to the actual functions. The 2D shaders
are set up similar to those in glsl, but with full 32-bit color (rgba)
support instead of paletted. However, the textures are not loaded yet,
nor is anything bound.
2021-01-10 15:56:17 +09:00
Bill Currie fed7149508 [vulkan] Parse sampler definitions 2021-01-10 15:50:24 +09:00
Bill Currie b40b3cff1c [vulkan] Use a size_t temp to parse uint32 values
Needed for swapbuffer frame count
2021-01-10 15:29:47 +09:00
Bill Currie ef817a5cbf [vulkan] Allow images to be created initialized
Needed for loaded textures.
2021-01-10 15:26:09 +09:00
Bill Currie e7106cce9e [plugin] Remove Draw_Init from draw funcs
It's never called outside the renderers.
2021-01-10 15:22:39 +09:00
Bill Currie 01b9c9bf78 [vulkan] Parse descriptor pools 2021-01-10 01:53:15 +09:00
Bill Currie e281b608e1 [vulkan] Provide access to swapchain image count
This necessitated hand-writing qfv_swapchain_t's descriptors as I don't
feel like getting that complicated with vkgen at this stage and it's not
really appropriate anyway? qfv_swapchain_t is meant to be read-only and
not parsed from a plist.
2021-01-10 01:51:15 +09:00
Bill Currie 0c1699fdbb Fix a pile of double semicolons 2021-01-09 20:42:23 +09:00
Bill Currie 5aa74df922 [renderer] Add a default 8x8 font
It is not compatible with the quake charset (it's the IBM charset). The
data is a simple bitmap but a converter to quake pic format is provided.
2021-01-08 14:37:52 +09:00
Bill Currie b6d2c63059 [vulkan] Fix some formtatting
Both code and developer output.
2021-01-07 22:49:43 +09:00
Bill Currie 90428db3d5 [glsl] Remove stray return statement
I have no idea why that was in that patch and certainly does not seem to
be correct.
2021-01-07 22:47:58 +09:00
Bill Currie 3b06ca01af [vulkan] Destroy pipeline on shutdown 2021-01-05 23:54:22 +09:00
Bill Currie 5eb1afdcb3 [vulkan] Implement pipeline creation
The prototypes for handle parsers needed to be changes because it turned
out "single" was inappropriate for handles as "single" allocates memory
for the parsed object, but handles must be written directly.
2021-01-05 23:42:30 +09:00
Bill Currie a45f8f98b6 [util] Make exprctx hashlinks double pointer
The way I wound up using the field meant that exprctx should not "own"
the hashlinks chain, but rather just point to it. This fixes the nasty
access errors I had.
2021-01-05 19:55:17 +09:00
Bill Currie d8b389d2b6 [vulkan] Initialize sType in parsed structures
This fixes a lot of validation issues, but still some fun with
uninitialized memory and bad accesses.
2021-01-05 18:26:01 +09:00
Bill Currie 3cf8a336a8 [vulkan] Clear out the resource tables on shutdown
This would take care of undestroyed resources if there wasn't a problem
with invalid memory use. Not sure what's going on just yet.
2021-01-05 17:48:00 +09:00
Bill Currie dc704a9384 [vulkan] Update the validation layer request
It's now Kronos as LunarG has been deprecated (explains why I got no
help with some of my debugging).
2021-01-05 17:46:03 +09:00
Bill Currie d22be09ae3 [vulkan] Clean up pipeline def loading 2021-01-05 17:45:02 +09:00
Bill Currie 7c661e7cc5 [vulkan] Remove renderpass from generated code
The creation of a render pass seems to need special handling.
2021-01-05 17:43:26 +09:00
Bill Currie e5708100bb [vulkan] Generate code for resource nodes
This makes it easy to add resource nodes defining contextually named
resources. It is already used for shaders, set layouts, and pipeline
layouts.
2021-01-05 14:15:35 +09:00
Bill Currie d8261ade9e [vulkan] Generate code for vulkan handles
The handles can be created in place or in resource blocks and referred
to by name (resource block code gen next).
2021-01-05 08:38:35 +09:00
Bill Currie 7e726545b8 [vulkan] Fix some string retention issues
I really need to come up with a better solution for managing strings in
quakec.
2021-01-04 19:28:27 +09:00
Bill Currie d919a85c8e [vulkan] Implement pipeline layout creation
It seems to work when parsing the layouts. They can be created in-line
(in theory) or in a "setLayouts" node and then referenced by name.
2021-01-04 17:36:11 +09:00
Bill Currie e4f75791ce [vulkan] Clean up some tangled dependencies
Dependencies on vkparse.hinc were spreading through the code which I
didn't want as that removes a lot of the automation from the automake
files. This keeps all parser code internal to vkparse.c's scope, and any
accesses required for enum and struct (not yet) definitions can be
fetched by name.
2021-01-04 17:26:39 +09:00
Bill Currie a6a3d4c6b5 [vulkan] Make array and single parsing smarter
Array and single type overrides now allow the parsing of the items
themselves to be customized. This makes it easy to handle arrays and
pointers to single items while also using custom specifications, rather
than relying entirely on the custom override.
2021-01-04 15:30:27 +09:00
Bill Currie c0c728b188 [vulkan] Fix a few code generation issues
QC's int type is named "integer" (didn't feel like changing that right
now), so special case it to be "int".

Output the parse func name (instead of "fix me").

Output a parse func for enums (needed for arrays of enums
(VkDynamicState)).
2020-12-25 00:17:20 +09:00
Bill Currie 9db80259d1 [gl,glsl] Copy fog color rather than return pointer
The static variable meant that Fog_GetColor was not thread-safe (though
multiple calls in the one thread look to be ok for now). However, this
change takes it one step closer to being more generally usable.

Patch found in an old stash.
2020-12-24 16:43:28 +09:00
Bill Currie cb2bdb0224 [util] Rename PL_ParseDictionary to PL_ParseStruct
Struct is far more appropriate for its function, and I need to parse a
dictionary into a hash table.
2020-12-24 13:33:37 +09:00
Bill Currie 5c0ce2c414 [vulkan] Correct the usage of custom field offsets
I had missed the array declaration and thus initialized the pointer to
the offset array incorrectly. Didn't show up until I tried using
multiple offsets.
2020-12-24 11:50:52 +09:00
Bill Currie 2430f44d7b [vulkan] Support parsing numeric types 2020-12-24 09:58:27 +09:00
Bill Currie 25ade4c0f3 [vulkan] Add support for custom parsers
And provisionally parse shader stage defs.
2020-12-24 01:36:17 +09:00
Bill Currie 017d2c1f44 [vulkan] Refactor vkgen struct generation
The addition of data an then string support made keeping track of things
in struct's writeTable a nightmare.
2020-12-23 22:13:50 +09:00
Bill Currie 7fb335a215 [vulkan] Add support for building and loading shaders
Shaders can be built as spv files and installed into
$libdir/quakeforge/shaders or as spvc files and compiled into the
engine. Loading supports $builtin/name to access builtin shaders,
$shader/path to access external standard shaders and quake filesystem
access for all other paths.
2020-12-23 14:32:29 +09:00
Bill Currie f1848bb5b7 [vulkan] Add support for parsing binary data 2020-12-23 14:08:53 +09:00
Bill Currie 91c5baa708 [util] Add size_t support to cexpr 2020-12-23 14:06:20 +09:00
Bill Currie 80aec45e35 [vulkan] Ensure msaa settings are consistent
I had forgotten that msaa samples was governed by the driver (as a max)
and the renderpass setup code simply took the max. Thus why 1 vs 8
caused the display to render incorrectly.
2020-12-21 20:17:27 +09:00
Bill Currie ac8206555e [vulkan] Get the parsed pipeline working
It turned out the msaa setting defaulting to 1 instead of 8 was the
problem no idea why at this stage (need to read up on just how that
setting works). Once I understand just how it works, I'll rework the
msaa handling.
2020-12-21 19:30:00 +09:00
Bill Currie 96df447c45 [vulkan] Hook up the expression parser
The pipeline parser still isn't hooked up yet as something isn't quite
right, but it seems all the parsing works.
2020-12-21 18:38:31 +09:00
Bill Currie 591667c36d [util] Add a context parameter to the plist parsers
Not used by the dict/array parsers themselves, but is passed on to any
value parser callbacks for their own use.
2020-12-21 14:22:42 +09:00
Bill Currie ab04a1915e [build] Fix a pile of gcc 10 issues
gcc got stricter about array accesses, complicating progs macros, and
much better at detecting buffer overflows.
2020-12-21 14:14:29 +09:00
Bill Currie 900728169e [build] Support silent rules for sed 2020-07-17 01:20:02 +09:00
Bill Currie 91ff15ca7c [vulkan] Correct some plist errors in the renderpass
Typos and incorrect attachment array reference.
2020-07-17 00:33:00 +09:00
Bill Currie f4c8d341e1 [vulkan] Implement most of the parser
This gets renderpass parsing almost working (not hooked up, though). The
missing bits are support for expressions for flags (namely support for
the | operator) and references (eg $swapchain.format). However, this
shows that the basic concept for the parser is working.
2020-07-17 00:29:53 +09:00
Bill Currie 8184c546db [vulkan] Fix dereference for non-pointer aliases
Fixes breakage for uint32_t for array/single handling.
2020-07-17 00:24:41 +09:00
Bill Currie 79177e96e8 [vulkan] Start work on scripted pipeline
Nothing is actually done yet other than parsing the built-in property
list to property list items (the actual parser is just a skeleton), but
everything compiles
2020-07-16 22:14:19 +09:00
Bill Currie 0945f30731 [vulkan] Use a property list to drive code gen
The property list specifies the base structures for which parser code
will be generated (along with any structures and enums upon which those
structures depend). It also defines option specialized parsers for
better control.
2020-07-05 16:53:35 +09:00
Bill Currie e4ee5c70e0 [vulkan] Rework vkgen alias handling
This is much cleaner and now that all the types are there properly,
doing a parser generator should be easier.
2020-07-05 16:53:35 +09:00
Bill Currie 2ca9f80d56 [vulkan] Split up vkgen
It worked as a proof of concept, but as the code itself needs to be a
bit smarter, it would be a lot smarter to break up that code to make it
easier to work on the individual parts.
2020-07-05 16:53:35 +09:00
Bill Currie cf3262991d [vulkan] Add a tool for making vulkan enum tables
The tables are generated from the enums pulled out of the vulkan headers
using a ruamoko program (thanks to its reflection capabilities). They
will be used for parsing property lists used to create render passes and
pipelines.
2020-06-28 19:08:18 +09:00
Bill Currie 19c75f5e49 [vulkan] Clean up QFV_CreateFramebuffer's prototype
It now takes qfv_imageviewset_t instead of separate count and
VkImageView array.
2020-06-28 13:53:11 +09:00
Bill Currie c1ffb05b87 Remove dead Makefile.am
Forgot this in the merge.
2020-06-25 16:14:39 +09:00
Bill Currie 86b5b30b45 Merge branch 'master' into vulkan 2020-06-25 14:03:52 +09:00
Bill Currie 6d5ffa9f8e [build] Move to non-recursive make
There's still some cleanup to do, but everything seems to be working
nicely: `make -j` works, `make distcheck` passes. There is probably
plenty of bitrot in the package directories (RPM, debian), though.

The vc project files have been removed since those versions are way out
of date and quakeforge is pretty much dependent on gcc now anyway.

Most of the old Makefile.am files  are now Makemodule.am.  This should
allow for new Makefile.am files that allow local building (to be added
on an as-needed bases).  The current remaining Makefile.am files are for
standalone sub-projects.a

The installable bins are currently built in the top-level build
directory. This may change if the clutter gets to be too much.

While this does make a noticeable difference in build times, the main
reason for the switch was to take care of the growing dependency issues:
now it's possible to build tools for code generation (eg, using qfcc and
ruamoko programs for code-gen).
2020-06-25 11:35:37 +09:00
Bill Currie 4cef9792f4 [util] Make hash-tables semi-thread-safe
They take a pointer to a free-list used for hashlinks so the hashlink
pools can be per-thread. However, hash tables that are not updated are
always thread-safe, so this affects only updates. progs_t has been set
up such that it is easy for multiple progs within one thread can share
hashlinks.
2020-03-25 15:43:16 +09:00
Bill Currie ad175d054b Sanitize pipelines
wow, talk about doing things the wrong way. I guess that's the problem
with following a book targeted for C++: you get all that safety-goat
nonsense.
2020-02-18 22:38:01 +09:00
Bill Currie 264c4ccdac Sanitize descriptors
I'm sure it will end soon, I think pipelines is the end of it.
2020-02-18 21:18:03 +09:00
Bill Currie c740dea212 Use the correct constant for "infinity" 2020-02-18 19:44:40 +09:00
Bill Currie 0a0035e5e5 Use the render pass to clear the window
Very satisfying to get to this point.
2020-02-18 17:48:22 +09:00
Bill Currie ba654b09f7 Create and destroy render pass and frame buffers 2020-02-18 17:18:37 +09:00
Bill Currie 1f4c019abc Create and destroy color/depth resources 2020-02-18 14:28:28 +09:00
Bill Currie 89d48b5650 Output first pixels
Just clearing the screen to 0xbada55, but the validation layer is quiet.
2020-02-18 01:03:36 +09:00
Bill Currie 73fde40cad Sanitize some more structs 2020-02-17 23:30:25 +09:00
Bill Currie 94565c2382 Rework much of the Vulkan array handling
So much for all those little wrappers hiding the device. Some survived,
but mostly just the bigger things like device, swapchain, etc.
2020-02-17 20:29:35 +09:00
Bill Currie 916e57de37 Get the swapchain image switching sort of working
The render pass isn't set up yet, so the validation layer is having a
fit, but cycling through the swapchain images does seem to be working.
2020-02-17 00:50:39 +09:00
Bill Currie ce72135e70 Fix incorrect init of command buffer set 2020-02-17 00:10:59 +09:00
Bill Currie 4b152a4492 Rework semaphore sets 2020-02-17 00:10:32 +09:00
Bill Currie 559bd2e636 Create command pool and frame timing fences
Nothing is actually done yet, so the reported fps is around 172k (yes,
k), but startup and shutdown seems to be clean (yay validation layers).
2020-02-16 22:45:27 +09:00
Bill Currie b947cc1791 Rework command buffer and fence-set management
I found command buffer handling to be totally redundant and fence-set
management to be a bit awkward.
2020-02-16 22:43:57 +09:00
Bill Currie d56f88f779 Implement swapchain image acquisition 2020-02-15 17:56:02 +09:00
Bill Currie 53b46f0541 Implement pipeline stuff 2020-02-13 04:21:35 +09:00
Bill Currie 69c110193a Fix a thinko
Wrong var for computing number of slots used.
2020-02-13 04:20:54 +09:00
Bill Currie 61036378e2 Implement render pass stuff 2020-02-12 18:55:51 +09:00
Bill Currie 44f5b134e6 Free custom descriptor structs
Forgot this earlier
2020-02-12 18:55:22 +09:00
Bill Currie 85a2f9f621 Implement descriptor stuff 2020-02-12 16:36:01 +09:00
Bill Currie 6e96b91aa1 Fix a couple more optimization warnings 2020-02-11 15:59:12 +09:00
Bill Currie 3144443a82 Allow vulkan_draw to compile when optimizing
Even though it's nowhere near done
2020-02-11 12:19:16 +09:00
Bill Currie 29b1d6baf8 Finish up memory stuff
For now, of course.
2020-02-11 09:37:04 +09:00
Bill Currie 1baee0cbba Implement mem mapping and buffer/image copying 2020-02-10 20:42:19 +09:00
Bill Currie 43e37aa31e Separate out the generic memory stuff 2020-02-10 18:33:29 +09:00
Bill Currie 9fdc15c439 Implement image stuff up to view creation 2020-02-10 18:18:37 +09:00
Bill Currie f4c0d0ebcf Implement buffer view creation
And rename memory allocation as it's buffer-specific.
2020-02-10 18:17:58 +09:00
Bill Currie 2f9ad73f78 Implement buffer memory up to barriers
Still lots to go (views, destruction, transfer...) and I'm uncertain
about the location of the pipeline barrier function.
2020-02-10 15:07:35 +09:00
Bill Currie 8148f256f5 Rework object device caching
It turned out I needed access to the physical device from a buffer
object, so rather than storing the vulkan logical device directly in
buffer (and other) objects, store the qfv logical device.
2020-02-07 11:45:05 +09:00
Bill Currie d3b4e4653e Cache physical devices in the instance 2020-02-06 19:04:28 +09:00
Bill Currie 8819d26c95 Fix a compile error
not sure how that one got through
2019-10-16 20:57:39 +09:00
Bill Currie 4957c4f31a Implement the rest of the command stuff 2019-07-23 13:05:32 +09:00
Bill Currie a165d67dfa Add a queue type 2019-07-23 12:37:47 +09:00
Bill Currie 411b897f09 Implement most of the stuff for command submission 2019-07-23 12:28:57 +09:00
Bill Currie 1f24a1408a Destroy the surface 2019-07-13 01:20:02 +09:00
Bill Currie dd1c2db249 Clean up the swapchain
And be a little safer about it
2019-07-13 01:14:21 +09:00
Bill Currie b4dc746a66 Clean up the debug callback 2019-07-13 01:11:34 +09:00
Bill Currie 1eafc33052 Ensure vulkan gets shut down 2019-07-13 00:36:21 +09:00
Bill Currie b2e12d701b Fix up swapchain creation
Things are working again.
2019-07-12 14:09:42 +09:00
Bill Currie 66e7336b62 Initialize device extension checks early
They need to be initialized before attempting to load the function
pointers.
2019-07-12 13:37:30 +09:00
Bill Currie 75f19f7243 Completely rework the vulkan related api
Things don't work yet, but this feels much cleaner.
2019-07-12 13:34:31 +09:00
Bill Currie b5828bc2ce Output validation message severity
It's nice knowing if something is an error or otherwise.
2019-07-11 00:58:37 +09:00
Bill Currie c0bc5cfad6 Implement swapchain creation 2019-07-11 00:58:14 +09:00
Bill Currie 2771e9c573 Correct extension handling
I had missed a critical bit from the cookbook.
2019-07-10 13:16:46 +09:00
Bill Currie ed3c5cb9ec Add a strset "class"
It's just a wrapper around hashtab, but it makes checking if a string is
in a set easy. Way overkill when only a few extensions are enabled, but
more might come later.
2019-07-10 13:09:16 +09:00
Bill Currie 3191604641 Uncomment already implemented functions 2019-07-09 21:07:59 +09:00
Bill Currie 8a3cd224a3 Add vulkan developer flag 2019-07-09 20:14:30 +09:00
Bill Currie 68449d0f6f Create a window and a surface for vulkan
Yay, segfaults in R_Init :)
2019-07-09 16:33:44 +09:00
Bill Currie 0f511e8342 Move the string list funcs to their own file
They're not (at this stage, at least) worthy of being promoted out to
the utils lib.
2019-07-09 14:24:55 +09:00
Bill Currie b3d982bfc3 Remove global vulkan_ctx
While I can't say that I'm happy with the details of vulkan_ctx_t, I am
pretty sure I don't want to be limited to having only one.
2019-07-09 11:54:23 +09:00
Bill Currie 707bdfc5f2 Get vulkan back to where it was 2019-07-09 09:06:35 +09:00
Bill Currie 8ee06d75a9 Separate render and presentation initialization
This paves the way for clean initialization of the Vulkan renderer, and
very much cleans up the older renderer initialization code as gl and sw
are no longer intertwined.
2019-07-09 01:00:47 +09:00
Bill Currie cb10175824 Pass vid_internal to R_LoadModule
This fixes the segfault and pushes things very much in the desired
direction of proper system independence for rendering and presentation
separation (though things were headed in the right direction before).
2019-07-08 14:04:03 +09:00
Bill Currie 6ee2df8445 Move vid callbacks into vid_internal
Currently segfaults because viddef is an alias for *r_data->vid, which
has not yet been initialized (chicken and egg).
2019-07-08 13:40:29 +09:00
Bill Currie 6137795682 Use deep binding for the vulkan loader
This fixes the problem with using vkGetInstanceProcAddr to find global
vulkan functions.
2019-07-07 16:48:53 +09:00
Bill Currie 7137d61c36 Add some extensions needed for presentation 2019-07-07 16:27:55 +09:00
Bill Currie a755e50c84 Clean up vid access a little
Things are still a mess, but a proper cleanup will be a lot of work and
will, really, involve properly splitting quake-specific code* out from
the rest of the renderer.

* data loading and format specific stuff
2019-07-07 15:38:29 +09:00
Bill Currie d95e9f9af3 Correct vulkan plugin strings 2019-07-07 14:59:20 +09:00
Bill Currie 77afc30486 Fix vid renderer plugin types
I guess that plugin type is currently not checked, otherwise I doubt the
mistake would have gone unnoticed.
2019-07-07 14:57:56 +09:00
Bill Currie 940ef833ae Shutdown Vulkan properly
Well, as properly as can be considering how little is started up :P
2019-07-07 14:34:02 +09:00
Bill Currie ab08e4f207 Create a logical device with a single queue
A single graphics-capable queue should be enough for now. However, I'm
not sure I'm happy with a lot of the code: it's a bit difficult to write
flexibly configured code for Vulkan (or seems to be at this stage),
especially in C.
2019-07-07 01:28:05 +09:00
Bill Currie 2bc78e7f0a Start work on a Vulkan-based renderer
Doesn't do much other than create an instance and enumerate some stuff,
but the build system is working.
2019-07-06 14:56:15 +09:00
Bill Currie f58c2fef5a Switch QF's quaterions from wxyz to xyzw.
After messing with SIMD stuff for a little, I think I now understand why
the industry went with xyzw instead of the mathematical wxyz. Anyway, this
will make for less pain in the future (assuming I got everything).
2018-10-12 14:33:55 +09:00
Bill Currie 34bcf7faab Do a pure/const/noreturn/format attribute pass.
I always wanted these, but as gcc now provides warnings for functions that
could do with such attributes, finding all the functions is much easier.
2018-10-09 12:42:21 +09:00
Bill Currie db3df6f8a7 Fix a bunch of dead increments. 2018-09-09 11:12:04 +09:00
Bill Currie 3f638d95ba Remove a possibly spurious break.
I'm not certain despair actually meant for the break to be there. It
certainly would have sped up the game a bit but at the expense of proper
blood trails in the software renderers.
2018-09-09 10:54:38 +09:00
Bill Currie 62793b2dc2 Fix some potentially garbage assignments.
These are the ones where I could easily make scan-build happy. They do seem
to be potential holes where invalid data in one place could result in use
of uninitialized values.
2018-09-09 09:54:16 +09:00
Bill Currie 59e85b7d5e Fix a pile of dead assignments.
Some were actual bugs!
2018-09-08 22:23:57 +09:00
Bill Currie 8fd5be0ee0 Fix a pile of sizeof goofs.
While scan-build wasn't what I was looking for, it has proven useful
anyway: many of the sizeof errors were just noise, but a few were actual
bugs (allocating too much or too little memory).
2018-09-07 20:00:57 +09:00
Bill Currie 4f58429137 Fix an unhealthy pile of gcc 8 warnings.
While some of the warnings were merely annoying, some where actual bugs or
unearthed bugs in related code.
2018-08-20 00:05:00 +09:00
Bill Currie bd52e46adf Merge branch 'master' into win 2016-01-22 01:10:49 +09:00
Johnny d1a8c1b277 Color swizzle & software lighting fix 2014-02-03 16:20:54 +09:00
Bill Currie d80342e0a8 Fix some compile errors from Johnny's patch.
Turns out he has to compile without -Werror.
2014-02-02 16:42:08 +09:00
Johnny 850382eed4 Fixes crashes when sw32_r_pixbytes is set to 2 or 4 2014-02-02 16:22:53 +09:00
Bill Currie 9d71d9bb7a Remove maxwarpwidth and maxwarpheight.
Only the sw32 renderer even tried to use them, and they didn't get set
properly. This fixes JohnnyonFlame's waterwarp issue.
2014-02-02 14:41:58 +09:00
Bill Currie 99678a571b Remove *.slc on make clean. 2014-01-28 16:26:24 +09:00
Bill Currie 3efb0c538f Separate file search from loading.
QFS_LoadFile (and its wrappers) now  take a file handle rather than a
path. This will make vpath usage a little cleaner to implement.
2014-01-28 16:22:05 +09:00
Bill Currie 4d59282641 Find the remaining vertex attribute order issues.
I hope. I do need to figure out why I made sprite blend an attribute
rather than a uniform.
2014-01-28 16:22:04 +09:00
Bill Currie a5db0b1a65 Remove the now unnecessary GLSL_CompileShaderS().
Now that the transition to using shader effects is comlete, there's no
need for the wrapper.
2014-01-28 16:22:04 +09:00
Bill Currie 57d2198140 Use the new shader system for iqm models. 2014-01-28 16:22:04 +09:00