Commit Graph

1397 Commits

Author SHA1 Message Date
Bill Currie 826e650c27 [models] Do full alias skin loading
This includes base, glow and two color maps (pants and shorts).
2021-01-26 20:33:51 +09:00
Bill Currie 57968249fe [vulkan] Start work on the alias pipeline 2021-01-26 10:20:50 +09:00
Bill Currie 3bbe33844a [util] Add component-wise vector mult-add/sub macros 2021-01-26 00:39:34 +09:00
Bill Currie d8b81e8678 [models] Remove MAXALIASFRAMES
The dynamic array macros made this much easier than last time I looked
at it, especially when it came to figuring out the bad memory accesses
that I seem to remember from my last attempt 9 years ago.
2021-01-25 13:33:42 +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 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 145e7478a7 [vid] Create a 32-bit version of the palette
The 32-bit palette includes the alpha channel, with color 255's alpha
set to 0.
2021-01-23 23:56:33 +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 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 328a529a94 Create RB_ACQUIRE and RB_RELEASE
RB_RELEASE is actually RB_DROP_DATA renamed, but RB_ACQUIRE and
RB_RELEASE work well when working with more structured ring buffer
contents.
2021-01-23 11:56:45 +09:00
Bill Currie e6704b85e1 Make RB_PEEK_DATA return the address of the data
This makes it a little more generally useful.
2021-01-22 18:29:35 +09:00
Bill Currie baf25f0891 Document the ring buffer macros 2021-01-22 15:22:04 +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 f96d7109af [vulkan] Fix a pure warning
Need to do more testing with optimized builds, but...
2021-01-22 02:13:58 +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 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 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 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 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 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 fa6ff04c5a [image] Use an enum for tex_t formats 2021-01-16 15:39: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 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 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 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 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 ef817a5cbf [vulkan] Allow images to be created initialized
Needed for loaded textures.
2021-01-10 15:26:09 +09:00