Commit Graph

171 Commits

Author SHA1 Message Date
Alibek Omarov c4757058e1 Merge upstream master 2023-04-28 17:15:31 +03:00
Alibek Omarov cb3b16e2ec engine: client: implement v_dark in engine, instead of making it ref-specific 2023-04-28 16:52:22 +03:00
Ivan Avdeev 8ac1a76259 rt: rename traceAdditive to traceSimpleBlending
This is to more clearly distinguish between simple blended things that
don't participate in lighting, and future more involved blending with
refraction and being affected by light
2023-04-27 10:59:38 -07:00
Ivan Avdeev 847777fb6b rt: do not forget to clear scratch buffer before loading new map
Fixes rare random crashes when loading maps with many models in it.
2023-04-27 10:59:38 -07:00
Ivan Avdeev 0b8b5b571b rt: sort transparent geometry ray hits
Limit to 8 layer for now. Seems to be working just fine.
VGPR usage and performance impact will be checked later.
2023-04-27 10:59:38 -07:00
Ivan Avdeev b79a65f8a1 rt: fixup incorrect oit application
Still doesn't work for us, as we also have purely emissive/additive
polygons. wOIT doesn't seem to support that fundamentally, each surface
should still attenuate the background.

Didn't even get to the _weighted_ part of it because of that.
2023-04-27 10:59:38 -07:00
Ivan Avdeev 449bcc4db9 rt: fixup blending emissive in background 2023-04-27 10:59:38 -07:00
Ivan Avdeev ae510dd3ff rt: use kusok.model.color
Fixes blending differences in test_brush/test_sprite maps. They now look
fairly similar (modulo color correction).

OIT is still a bit off, but good enough for now
2023-04-27 10:59:38 -07:00
Ivan 'provod' Avdeev d6a41bc041 rt: try weighted oit
Known issues:
- test_brush blend modes are broken
- emissive does not participate in weighted oit properly
2023-04-27 10:59:38 -07:00
Ivan 'provod' Avdeev d576818550 rt: implement mix blending with undefined order
Known issues:
- apparently BLEND_MIX surfaces should also participate in lighting. Figure out how.
- sensitive to ray tracing order. Need proper OIT (or hacks)
2023-04-27 10:59:38 -07:00
Ivan 'provod' Avdeev 3800d6559e rt: restore glow
This required uploaded kusochki only later during frame time, just before rendering the model. Otherwise they would get incorrect rendermode.

Also add blend mode debug colors.
2023-04-27 10:59:38 -07:00
Ivan 'provod' Avdeev 1ebc1d207c rt: commoditize setting material mode
Known issues:
- Breaks sprite glow for some reason.
2023-04-27 10:59:38 -07:00
Ivan 'provod' Avdeev 5b370509fe rt: group Material and ModelMetadata in Kusok
They have mismatching frequencies. ModelMetadata should be per-Model, there should be only a few dozen of these.
There maybe hundreds (or even thousands) of materials, but one material can be still referenced by many kusochki.

This only moves fields into new structs, which still belong to Kusok. The real extraction will happen later, see #52.
2023-04-27 10:59:38 -07:00
Alibek Omarov 27aad9f4a0 ref: gl: add size argument to COM_Default/ReplaceExtension calls 2023-04-26 05:20:45 +03:00
Alibek Omarov 8b96e7ca87 ref: add size argument to COM_FileBase calls 2023-04-26 05:20:45 +03:00
Alibek Omarov 8f207362a5 public: remove Q_sprintf, and patch all code that used it to use Q_snprintf instead 2023-04-26 05:20:45 +03:00
Alibek Omarov 096ee34f67 public: remove Q_vsprintf, replace by proper Q_vsnprintf proper calls
Fixes weird off by one error caused by glibc updates? I didn't tracked
what causes it exactly but replacing it seems to work. Anyway, we should
remove all 99999 hacks in libpublic.
2023-04-23 18:19:28 +03:00
Ivan Avdeev 935c2e7f5e rt: remove a bunch of extra material flags
These are either unused, or their meaning can be recovered through other
means.
2023-04-21 23:34:27 -07:00
Ivan Avdeev 41b033efbd vk: comment various material-related things
This is in preparation for #460
2023-04-21 23:34:27 -07:00
Ivan Avdeev e9f15edbd5 vk: fix refercing func_wall ents by indexes; only model names work 2023-04-19 20:25:00 -07:00
Ivan Avdeev d7660cf358 vk: patch func_wall ents by their index, not model name
Note that referencing them by ent->index inside the engine is not
possible, as this index is not stable enough.
2023-04-19 20:25:00 -07:00
Ivan Avdeev ca2a794341 vk: patch func_wall model/ents visible offsets
Fixes #335

Patching is still done using "model" key, using "_xvk_ent_id" needs
complete overhaul of how patching is done
2023-04-19 20:25:00 -07:00
Ivan Avdeev 7c6e22bb2c rt: extract basic func_wall patching support from PR #506
That PR has more stuff in it which we decided to drop.

This commit only contains:
- Detection of func_wall models, and adding their lights as static
  (fixes #415).
- Patching func_wall models offsets, #335. Does not yet patch them
  visually, but patches their light sources. Will be addressed in next
  commits. Patching is done via model name, not entity id, also will be
  fixed.
- Does not address culling (#118). This is the part dropped from the PR.
  Needs different approach. TBD
2023-04-19 20:25:00 -07:00
Ivan Avdeev cfddb75bc5
rt: remove freeze_models functionality (#513)
It's been obsolete and broken for many months now.

Fixes #509
2023-04-15 10:51:34 -07:00
Ivan Avdeev b4dde5bafd
rt: don't cull c/cw triangles to fix shadow leaks (#508)
de_cbble contains a bunch of floating boxes, which makes sunlight leak if internal back-facing surfaces are culled.

Generally, we should not be culling ray traced triangles (unless absolutely necessary for correctness), as it makes the shader perform additional unnecessary checks.

Try disabling culling universally and see whether it breaks anything.

Fixes #507
2023-04-15 09:44:04 -07:00
Alibek Omarov f55ef63e26 ref: optimize R_LightLambert function
* Quick exit if no local lights
* Try to minimize Q_min() checks by apply it on temp variables
* Cap final light values only once, after all local lights are calculated
2023-04-14 20:33:07 +03:00
Ivan Avdeev 2dd4059704 vk: fix func_wall surface patching
Non-worldmodel models were using incorrect surface indexes when asking
for surface patches.
2023-04-14 10:08:40 -07:00
Ivan Avdeev b894337d0e vk: fix validation errors for empty combufs 2023-04-13 11:03:36 -07:00
Ivan Avdeev 1b0c8c763e vk: slightly improve texcoord patching
Now _xvk_tex_offset and _xvk_tex_scale can be used independently to
offset or scale texture coordinates for given surface list.
2023-04-13 11:03:36 -07:00
Ivan Avdeev b5e5d699bc vk: deduplicate map (re)loading code 2023-04-13 11:03:36 -07:00
Ivan Avdeev b3ffd911bb vk: allow dynamic surface/material patching
Refactor NewMap and patch loading a bit.
2023-04-13 11:03:36 -07:00
Ivan Avdeev 90591cfb3d vk: add patching props for surface texture coordinates 2023-04-12 11:57:07 -07:00
Ivan Avdeev 1fd9e49f63 vk: add normal_scale to materials 2023-04-12 11:57:07 -07:00
Ivan Avdeev 9116b0268e vk: scale metalness/roughness textures by m/r values in material
fixes #342
2023-04-12 11:57:07 -07:00
Ivan Avdeev 51318fc77f vk: read alpha for material base_color, fixes #308 2023-04-12 11:57:07 -07:00
Ivan Avdeev 139807a559 vk: profiler: add device/driver info 2023-04-10 12:05:35 -07:00
Ivan Avdeev c917c7a818 vk: profiler: move graphs a bit lower 2023-04-10 10:24:57 -07:00
Ivan Avdeev 93153dd87e vk: profiler: tame the gpu scopes ladder 2023-04-10 10:24:57 -07:00
Ivan Avdeev 084874c5c8 vk: profiler: add gpu scopes for staging uploads 2023-04-10 10:24:57 -07:00
Ivan Avdeev a38f990ef5 vk: attempt to fix 32 bit build 2023-04-10 10:24:57 -07:00
Ivan 'provod' Avdeev fdab0f7536 vk: fix windows compilation 2023-04-10 10:24:57 -07:00
Ivan Avdeev 92ce698292 vk: profiler: cover staging with combuf scopes; add build_as time 2023-04-10 10:24:57 -07:00
Ivan Avdeev f6201e460f vk: profiler: register gpu scopes as metrics for graph purposes 2023-04-10 10:24:57 -07:00
Ivan Avdeev 6d43e02dd3 vk: profiler: draw internal gpu side frame structure 2023-04-10 10:24:57 -07:00
Ivan Avdeev 1bf6f6ee74 vk: profiler: extract gpu timestamps in a generic manner 2023-04-10 10:24:57 -07:00
Ivan Avdeev 73a6cf596a vk: init combuf
it does just work lol
2023-04-10 10:24:57 -07:00
Ivan Avdeev 4bd62ccbc0 [draft] vk: start refactoring commandbuffer/gpu profiler
Consolidate VkCommandBuffer management into a single entity. (somewhat
done for framectl, not done for staging)

Make sure that we pass enough metadata to be able to timestamp scopes in
cmdbuf.

It does compile, but it won't work: not all init code paths are used.
Also, there are many changes, so other failure modes are totally
possible.
2023-04-10 10:24:57 -07:00
Alibek Omarov 79624fa400 ref: gl: cleanup unused functions 2023-04-03 05:09:33 +03:00
Alibek Omarov 550ced9c36 ref: gl: cleanup unused functions in frustum 2023-04-03 05:05:32 +03:00
Alibek Omarov fd795d5612 ref: soft: cleanup unused functions 2023-04-03 04:57:41 +03:00