Commit graph

13497 commits

Author SHA1 Message Date
Bill Currie
6deeed1829 [vulkan] Get the output step working for draw
It leaks command buffers (due to a misunderstanding of
vkResetCommandPool), but it seems 2d draw (sliced quads) is working
nicely.
2023-06-22 11:17:03 +09:00
Bill Currie
3de39f5408 [vulkan] Destroy frame buffers on shutdown
With this, the new render system, though not doing anything useful, at
least passes validation.
2023-06-22 11:17:03 +09:00
Bill Currie
25cfef18d6 [vulkan] Use per-swapchain images for output framebuffers
Imageless framebuffers would probably be easier and cleaner, but this
takes care of the validation error attempting to present the second
frame (because rendering was being done to the first frame's swapchain
image instead of the second frame's).
2023-06-21 14:47:19 +09:00
Bill Currie
503013dd38 [vulkan] Use per-frame command buffer pools
Command buffer pools can't be reset until the commands have all been
executed. Having per-frame pools makes keeping track of pool lifetime
fairly easy.
2023-06-21 13:46:29 +09:00
Bill Currie
f0d32ba956 [vulkan] Rearrange allocations for alignment
Interleaving Vulkan objects with stucts containing vec4f_t results in
the vectors becoming unaligned when there is an odd number of objects in
a set, thus producing a segfault. Putting all the structs first prevents
any such issue.
2023-06-21 13:43:04 +09:00
Bill Currie
7da8399220 [vulkan] Pass validation for the first frame
The new render system now passes validation for the first frame (but
no drawing is done by the various subsystems yet). Something is wrong
with how swap chain semaphores are handled thus the second frame fails.

Frame buffer attachments can now be defined externally, with
"$swapchain" supported for now (in which case, the swap chain defines
the size of the frame buffer).

Also, render pass render areas and pipeline viewport and scissor rects
are updated when necessary.
2023-06-20 15:18:58 +09:00
Bill Currie
38453f3d2f [vulkan] Increment render pass index one at a time
This fixes the bogus render pass objects.
2023-06-18 19:58:10 +09:00
Bill Currie
2cadf040d3 [vulkan] Add a step and task to create a framebuffer
I don't like the current name (update_framebuffer), but if the
referenced render pass doesn't have a framebuffer, one is created. The
renderpass is referenced via the active renderpass of the named render
step. Unfortunately, this has uncovered a bug in the setup of renderpass
objects: main.deferred has output's renderpass, and main.deferred_cube
and output have bogus renderpass objects.
2023-06-18 18:42:07 +09:00
Bill Currie
8e25fb13d1 [cexpr] Add string and voidptr types
The string type is useful for passing around strings (the only thing
that they can do, currently), particularly as arguments to functions.
The voidptr type is (currently) never generated by the core cexpr
system, but is useful for storing pointers via cexpr (probably a bit of
a hack, but it seems to work well in my current use).
2023-06-18 17:20:38 +09:00
Bill Currie
d8239bf9e2 [qtypes] Support auto in pre-c23 compilers
I'm not yet ready to do a full-on transition to gcc-13 with -std=gnu2x,
but I'm tired of __auto_type's ugliness.
2023-06-18 17:16:58 +09:00
Bill Currie
65b2e1750c [build] Fix escaping of \ in plist to plc
Quoting is hard.
2023-06-18 17:14:34 +09:00
Bill Currie
3235bb70c8 [vulkan] Move attachement specs into frambuffer
This does a better job of keeping related data together.
2023-06-17 12:13:38 +09:00
Bill Currie
14b24e5b75 [vulkan] Clean up job allocation size calculation
It does the same thing, but it's just nicer to read (thanks for the
idea, HomelikeBrick42).
2023-06-16 23:15:31 +09:00
Bill Currie
b33a897ae4 [vulkan] Submit particle physics push constants directly
Trying to do it in the task system meant copying pointers in a larger
buffer, which rarely ends well.
2023-06-16 22:37:27 +09:00
Bill Currie
274e821c06 [vulkan] Pass the current command buffer to tasks
Compute and render tasks need to be able to submit commands.
2023-06-16 22:34:08 +09:00
Bill Currie
b0d1c0e75b [vulkan] Make push constant ranges structured
Being able to specify the types in the push constant ranges makes it a
lot easier to get the specification correct. I never did like having to
do the offsets and sizes by hand as it was quite error prone. Right now,
float, int, uint, vec3, vec4 and mat4 are supported, and adheres to
layout std430.
2023-06-16 19:05:53 +09:00
Bill Currie
c1b85a3db7 [vkgen] Support custom parsing in multi-type fields
This allows the likes of:

    qfv_pushconstantrangeinfo_s = {
	.name = qfv_pushconstantrangeinfo_t;
	.type = (QFDictionary);
	.dictionary = {
	    .parse = {
		type = (labeledarray, qfv_pushconstantinfo_t, name);
		size = num_pushconstants;
		values = pushconstants;
	    };
	    stageFlags = $name.auto;
	};
	stageFlags = auto;
    };

Leading to:

    pushConstants = {
	vertex   = { Model = mat4; blend = float; };
	fragment = { colors = uint; base_color = vec4; fog = vec4; };
    };

Where the label of the labeled array (which pushConstants is) is
actually an enum flag and the dictionary value is another labeled array.
2023-06-16 18:53:37 +09:00
Bill Currie
bcfb2ad182 [vkgen] Shorten "qfv_*" enum names
The up-coming changes to push constant handling has qfv_float etc type
enum values and using "float" instead of "qfv_float" is highly desirable
as the names match the glsl type names.
2023-06-16 18:49:58 +09:00
Bill Currie
57da924c1b [plist] Put quotes around the unknown field name
I got rather confused by "unknown field type" when "type" was the field
name.
2023-06-16 18:47:24 +09:00
Bill Currie
387051fedf [vulkan] Split up render job loading and running
The creation of the render jobs doesn't really belong with the running
of those jobs. This makes the code a little easier to navigate as it was
too easy to lost between load-time and run-time code.
2023-06-15 17:29:41 +09:00
Bill Currie
3c65f1494b [vulkan] Get some subsystems passing validation
This is with the new render job scheme. I very much doubt it actually
works (can't start testing until everything passes, and it's disabled
for the moment (define in vid_render_vulkan.c)), but it's helping iron
out what more is needed in the render system.
2023-06-15 15:17:39 +09:00
Bill Currie
97f9fd81d6 [vulkan] Switch around renderpass and subpass names
The old structs will go away eventually, and I'm tired of seeing that _
tail.
2023-06-15 13:13:52 +09:00
Bill Currie
8ff60b4603 [simd] Add unsigned vector types
Mostly as a convenience for working with very small arrays of unsigned
ints.
2023-06-15 09:36:50 +09:00
Bill Currie
9d1c07d2ac Fix a few strict aliasing warnings
gcc 13 got a little stricter on those (at least with gnu2x/c2x).
2023-06-13 18:13:54 +09:00
Bill Currie
db889e5e54 [util] Fix a local variable address warning
Despite mdfour claiming not to be fast, it tried to avoid passing a
pointer around via a global instead of parameters. Long obsolete and
iffy to boot.
2023-06-13 18:11:11 +09:00
Bill Currie
dbd3d6502a Nuke qboolean from orbit
I never liked it, but with C2x coming out, it's best to handle bools
properly. I haven't gone through all the uses of int as bool (I'll leave
that for fixing when I encounter them), but this gets QF working with
both c2x (really, gnu2x because of raw strings).
2023-06-13 18:06:11 +09:00
Bill Currie
9871b44d68 [build] Fix a warning in attribute const check
The warning flag check worked too well: it enabled the warning and
autoconf's default main wanted the const attribute. The bug has been
floating around for a while, it seems.
2023-06-13 13:08:38 +09:00
Bill Currie
331f3320e2 [gatest] Rearrange the 2d PGA groups
Following the suggestions of Hamish Todd, group 0 forms the planar
quaternions (with the "complex number" in the first two components) and
transflections in group 1.
2023-06-08 22:46:02 +09:00
Bill Currie
0fbcd90e37 [gatest] Fix up layout issues for null vectors
e0 is created only if there are null vectors in the algebra, and the 3d
and 2d basis groups have been rearranged to compensate in the changed
ordering in the basis blade array.
2023-06-08 22:13:23 +09:00
Bill Currie
a40fee2513 [gatest] Calculate correct sign for duals
I was aware in the beginning that the signs were probably incorrect, but
I had left them as I wasn't sure how they worked.  Thanks to enki
(bivector community), I was pointed in the right direction for getting
the calculations right: the product of a basis blade with its dual
(x !x) must product the positive pseudo-scalar.
2023-06-08 13:02:13 +09:00
Bill Currie
2858870153 [gatest] Fix use of uninitialized multivector components
I guess I had forgotten that new_mv() does *NOT* initialize the
components. Things just happened to work (usually) because memory was
not getting recycled.
2023-06-08 13:00:32 +09:00
Bill Currie
68ca8c7016 [gatest] Switch to using e0 for the null vector
According to enki (bivector community) when there are more than one null
vector in a geometry, usually all vectors are null, and it was what to
do with multiple null vectors that caused me to balk at using e0 for the
null vector. However, using e0 for the null vector makes life much
easier, especially as that's what most of the literature does. There
are plenty of places, particularly in layout handling, that still need
adjustment for the change, but things seem to work (minus duals, but
they were broken in the first place, thus the discussion with enki).
2023-06-08 12:56:23 +09:00
Bill Currie
fe045f75fb [qfcc] Force live vars used by function statements
This uses ud-chains for function statements (call/return) to force their
arguments to be live (in particular, indirect references via pointers)
this fixes the arraylife test.
2023-06-05 17:20:12 +09:00
Bill Currie
fb1b3e0869 [qfcc] Use ud- and du-chains for block live analysis
The ud- and du-chains include known side-effects of the instructions and
thus depict a more accurate view of what operands an instruction uses or
defines. Fixes the arraylife2 test.
2023-06-05 11:03:44 +09:00
Bill Currie
a5ed154cfe [qfcc] Add a second failing array lifetime test
This one covers regular array references across function call.
2023-06-05 10:58:02 +09:00
Bill Currie
38fd09573f [qfcc] Avoid defining whole temp via alias
Like defs, a partial write should not define the whole temp. Thus, copy
the "don't visit main" behavior recently added to def_visit_all. Fixes
missing ud-chains for component-by-component assignments to temporary
vectors.
2023-06-05 09:42:33 +09:00
Bill Currie
8f6e145257 [qfcc] Don't add target def for store statements
Store statements dereference the pointer in target and thus don't modify
target itself.
2023-06-04 11:45:35 +09:00
Bill Currie
e2c1da9b6a [qfcc] Create du-chains from ud-chains
I'm not certain this is correct, but it seems to me that du-chains are
the same information as ud-chains, but from the defining statement's
point of view instead of that of the using statement.
2023-06-04 11:24:52 +09:00
Bill Currie
7149a092f6 [qfcc] Create ud-chains more aggressively
As certain statements (in particular, function calls) can use additional
variables via pointer parameters, it's necessary to iterate ud-chain
building until the count stabilizes. This should make live variable
analysis much easier.
2023-06-04 01:47:30 +09:00
Bill Currie
d0e2c0a9d9 [gatest] Allow specifying the algebra on the command line
Saves having to recompile for a different algebra. Right now, just
`-a p,m,z` is supported.
2023-05-29 15:14:59 +09:00
Bill Currie
65764a06c0 [gatest] Don't lex . as a single character
Lexing . as a single character makes it impossible to enter fractions.
Unfortunately, this means that . as dot product requires white space on
either side.
2023-05-29 15:13:27 +09:00
Bill Currie
6bd9aceb28 [ruamoko] Correct signatures of strtol and strtoul
I had forgotten the base parameter in the ruamoko definitions (verified
there in the C wrapper).
2023-05-29 15:12:20 +09:00
Bill Currie
681629a5d1 [gatest] Parse division and dual operations 2023-05-29 09:52:10 +09:00
Bill Currie
4e441d359a [gatest] Write a simple parser for playing with GA
Currently only PGA(3) is supported, but that's because the parser is
rather simple (recursive descent with a lame lexer), but it works well
enough for playing with geometric algebra without having to recompile
every time.
2023-05-27 12:47:33 +09:00
Bill Currie
582423a019 [ruamoko] Extend the string api
Wrap the strtod, strtof, strtol, strtoul functions, supporting the end
pointer as well (if not nil, the int offset of the end pointer relative
to the string start is returned).

Also, str_unmutable creates a return string from a mutable string
(copying it).
2023-05-27 12:47:33 +09:00
Bill Currie
a22c2224e0 [ruamoko] Fortify and extend the script api
Meaning some leaks have been plugged, and some useful functions added:
loading a file (avoids polluting progs memory), setting the single
character lexeme string, and getting the line number.
2023-05-27 12:47:33 +09:00
Bill Currie
ac42bca98b [ruamoko] Support nil object in obj_error
Segfaulting when trying to produce an error message doesn't help get the
message out. Sure, `obj_error (nil...)` is a bit of an abuse, but it
shouldn't segfault the engine.
2023-05-27 12:47:33 +09:00
Bill Currie
5d9823af30 [qfcc] Implement designated initializers
Conforms fairly closely to GCC's C implementation.
2023-05-27 12:47:33 +09:00
Bill Currie
04e26a7b9f [set] Check for 0 count correctly
I don't know what I was thinking when I checked for 0 count for resizing
the set. Attempting to add/remove 0 elements results in adding/removing
4G elements. Oops.
2023-05-27 00:55:22 +09:00
Bill Currie
09a3e257e8 [qfcc] Fully initialize local structural defs
I think the current build_element_chain implementation does a reasonable
job, but I'm in the process of getting designated initializers working,
thus it will become important to ensure uninitialized members get
initialized.
2023-05-26 21:56:19 +09:00