18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 08:17:09 +01:00
Commit Graph

7 Commits

Author SHA1 Message Date
maj00r 6c7ec65825 feat(render): the skinned parts of EU07M models moved by a compute shader in Vulkan
The skinning of stage 4 moved the vertices on the CPU and replaced the geometry of each instance. The Vulkan renderer moves
them in a compute shader now; GL 4.6 stays on the CPU.

- gfx::skin_cache: the walks only work out the palette of the joints; flush(), before the walks of the next frame, moves
  the vertices of the instances whose pose changed: through the new GfxRenderer->Skin_Geometry() where the renderer can,
  else on the CPU with Replace / Replace_Indexed as before. A chunk made or emptied makes the buffers of the bank anew from
  the vertices the CPU holds, so every instance skinned on the GPU is moved again then.
- Vulkan (rendering/vulkan14/vulkan14skinning.cpp, shaders/vk14/skin.comp): the bind pose with the weights of a skinned
  part goes to the GPU once, the palette in the ring of the frame; the kernel writes the moved vertices over those of the
  chunk of the instance in the buffer of its bank (gfx::basic_vertex), with barriers against the copies of the uploads and
  the draws of the frames before, and before the draws of the frame. The vertex buffers of the plain banks get the
  storage usage. The kernel is made the first time a part is skinned; without it the CPU moves them.
- eu07.ini: gfx.skinning.gpu (default yes); no moves them on the CPU in Vulkan too. Both give the same picture.

Checked in Vulkan: a tube of two joints turned by 60 degrees, GPU against CPU, with gfx.gpucull 0 and 1: no pixel
differs, and the log shows the kernel ran. Two instances, the second posed later: the first keeps its pose through the
rebuild of the bank, the same as on the CPU. A clip moving the tube every frame. GL 4.6 after the change of the cache:
both instances bent as before (time let run in the editor for the tests only). Unit tests 1200/1200. Not measured on a
large scene, not built with GCC here.
2026-11-29 01:17:01 +01:00
maj00r 92cc2dcc28 refactor(model): the new model format is EU07M (.eu07m), not E4D
E4D read as the next version of E3D, which the format isn't meant to be tied to; EU07M goes with the world format .eu07.
The format isn't released, so nothing reads the old name.

- The extension .eu07m, the magic EU7M (the four bytes of the header), model/eu07m/ with eu07m_*.{h,cpp},
  namespace eu07m, docs/eu07m-format.md, tests/unit/test_eu07m.cpp.
- The command line -eu07m convert|dump|validate|diff, TModel3d::LoadFromEU07M, and the key modelformat eu07m|legacy
  of eu07.ini (Global.modelformat_eu07m).
- Nothing else changes: the sections, the records and the components are the same, so a converted file needs only its
  magic and its extension changed.

Unit tests 1189/1189.
2026-11-28 22:02:05 +01:00
maj00r 5185d69dc9 feat(render): the Vulkan renderer keeps the vertex streams of E4D models as they are, 28 bytes a vertex
Stage 3 of the E4D model format. A model loaded from .e4d (modelformat e4d) reaches the Vulkan renderer as its compact
streams: positions (12 B), attributes (QTangent snorm16x4 + uv f32x2, 16 B), user data and indices, without the 48-byte
gfx::basic_vertex in between.

- gfx: gfx::compact_attributes, geometry_bank::create_compact() and GfxRenderer->Insert_Compact(). The default of
  Insert_Compact decodes to basic_vertex, so the OpenGL 4.6 and the null renderers get the models as before. The CPU
  readers of a chunk (pantograph, bounds, picking, the editor) get basic_vertex made from the streams the first time they
  read it; a chunk which is changed (replace, append) turns into basic_vertex first.
- Vulkan: a bank whose chunks are all compact keeps positions, user data, attributes and indices in buffers of their own;
  vertex_kind::scene_compact reads them (location 5 the quaternion as R16G16B16A16_SNORM). A program gets a COMPACT_VERTEX
  variant the first time a compact chunk is drawn with it, in the background with gfx.vulkan.asyncresources, as the
  MODEL_DRAWS one; the variant of the multi draws makes a compact one of its own. Only vertex.vert and cabprobe.vert
  decode the normal (compact_frame() in common.glsl); the shaders of shadows, prepass, picking and cube shadows read
  position and uv as before.
- Ray tracing: the BLAS of a compact chunk reads the positions with a stride of 12, and the reflections read the normal
  and uv from the attributes (RT_FLAG_COMPACT in the record). Not tried with ray tracing on.
- The loader hands the streams of the file to Insert_Compact as they are; the stars keep their colours in the normals
  of basic_vertex and go as before.

Measured on Vulkan (self-test, 250 models of the game, runs alternating with legacy): device memory 1.60-1.64 GiB
against 1.89 GiB, GPU time a frame 1.27-1.39 ms against 1.37-1.57 ms, the same frame time and load time, the picture
within 1/255 of the legacy one, no errors of Vulkan in the log. Unit tests 1189/1189; -e4d diff gives the same results
through the new decode. Not built with GCC here.
2026-11-28 21:52:47 +01:00
Hirek ad71963a4e fix(render): the Vulkan renderer checks its cache files, backs off when memory runs out and keeps its threads alive through any exception 2026-11-25 15:29:31 +01:00
Hirek 1447dcf075 Walk the shadow passes and the culled model groups on worker threads in the Vulkan renderer 2026-10-27 20:56:11 +01:00
Hirek f20b1a3071 Replace cubemap scenery reflections with SSR, add Vulkan ray traced reflections 2026-10-25 13:54:49 +01:00
Hirek 9b7d02e5fb Vulkan: scene rendering (D1–D7) on a scene walk shared with GL (N6a, N6b) 2026-10-24 20:10:24 +02:00