When texture coordinates are inverted, it makes tangent look into
oppsite direction, which inverts TBN and therefore normal map.
Make sure the tangent points to a consistent direction.
Fixes#627
It was using old pre-transform values for prev_verts, and that was
confusing temporal denoiser.
We should bone-transform vertices first, and only then store them as
prev_verts.
Fixes#585
Uses `_xvk_smoothing_excluded` field.
Surfaces can still be smoothed with a limited list of neightbours explicitly
by being included in a smoothing group.
Fixes#619
This is not a valid reason to assert/crash, even though it is clearly a programming mistake.
If the stack is corrupted, just print its contents as an S_ERROR and continue.
Also:
- Fix the ultimate reason for stack being unbalanced for #604
- Do not analyze scopes when not needed, i.e. when `r_speeds` is zero.
Fixes#604
Use dedicated hash table for new material names.
Updates a lot of dependent code:
- surface patches now target materials, not textures:
`s/_xvk_textures/_xvk_material`
- patching now affects only materials, not texture ids. All logic that
depends on texture ids now operate on original textures.
- brush normal smoothing now ignores patched surface materials when
deciding whether two surfaces can be smoothed.
The rationale is that patching should only affect newer PBR/RT code paths.
Legacy ref_interface_t texture access is not refcountable. It does
create/destroy texture in a single call regardless of other users.
Track it with a separate flag that affects refcount with a single +1/-1.
Too many places in the engine and the renderer expect texture names to
be insensitive: RAD files, material references, probably engine and game
calls too.
Make it universally case insensitive. Also, add rudimentary tests for
it.
Previous hash table was case insensitive, while the new one is
sensitive.
For now the workaround is to tolower texture names in rad files.
Proper way would be to address case-sensitivity globally. Currently it's
not very consistent.
Known issues:
- pbr materials are completely broken. They end up not being able to
find textures, seemingly due to memory corruption on materials side,
not textures.
- There are still places that try to get texture=1
Adds unordered_roadmap simple hash map:
- open addressing with linear probing
- size is fixed at init/compile time
- operates on an pre-allocated array of items with hashmap headers
Also adds basic tests for it.
And properly enables tests for ref_vk (i.e. alolcator)
THIS COMMIT IS BROKEN AND LEADS TO MISSING TEXTURES
There's a "race" between texture release/acquire on changelevel.
Textures end up being deleted when they shouldn't.
Addressing this is tedious, will be done in the following commits.
We were running out of descriptor sets, as they weren't being freed at all.
Now there's a 1-1 table of texture-descset, and no way to run out of them.
Better solution would be to move this descset management to vk_render, and allocate them dynamically from a smaller pool.
Support DDS and KTX2
- [x] Pass KTX2 as raw data
- [x] Simplify image uploading (there are 2 copies of the same uploading code for regular textures and for KTX2)
- [x] Extract long format lists from `vk_image.c` to e.g. `vk_image_extra.h`
- [x] Support DDS formats
- [x] BC7
- [x] PoC works
- [x] read supplied mips
- [x] Pass most common KTX2 subformats as correct PF_ format
- [x] BC5
- [x] BC6H
- [x] BC7 -- need UNORM/SRGB expansion
- [x] BC4 -- need to add it
- [x] Alpha flag for KTX2 formats
- [x] swizzle r->rgba
- [x] check il_dds_hardware
- [x] add `IL_KTX2_RAW_SUPPORTED`
- [x] format imagelib things
- [x] extract image size function to img_utils
Fixes#154